Users.cs
789 Bytes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MongoDB.Driver;
using MongoDB.Bson;
namespace AIAHTML5.API.Models
{
public class Users
{
internal static dynamic Authenticate(Newtonsoft.Json.Linq.JObject credentials)
{
var client = new MongoClient();
var db = client.GetDatabase("AIA");
var col = db.GetCollection<dynamic>("Users");
BsonDocument filter = new BsonDocument();
filter.Add("username", credentials["username"].ToString());
filter.Add("password", credentials["password"].ToString());
dynamic userDetails = col.Find(filter).SingleOrDefault();
return userDetails;
}
}
}