Пример #1
0
 // GET: Validation
 public JsonResult UNExist(RegisterUserModel user)
 {
     var cnt = MongoDBConnector.Users.CountAsync(Builders<ChatUserModel>.Filter.Eq(x => x.UserName, user.UserName)).Result;
     if (cnt > 0)
         return Json("Error Name!", JsonRequestBehavior.AllowGet);
     else return Json(true, JsonRequestBehavior.AllowGet);
 }
Пример #2
0
 public ActionResult Create(RegisterUserModel um)
 {
     var ph = MD5Hasher.GetHash(um.Password);
     var user = new ChatUserModel { _id = ObjectId.GenerateNewId(), IsAdmin = false, LastAction = DateTime.UtcNow, PasswordHash = ph, UserName = um.UserName};
     MongoDBConnector.Users.InsertOneAsync(user);
     this.AddCookieForCurrentUser(user);
     return RedirectToAction("StartRoom","Home",null);
 }
Пример #3
0
 public ActionResult Create()
 {
     var um = new RegisterUserModel();
     return View(um);
 }