예제 #1
0
 public JsonResult checkUsernameExists(ValidateAccountRequest req)
 {
     var _db = new ZestorkContainer();
     if (_db.Users.Any(x => x.Username == req.userName))
     {
         return Json(new { code = "402", msg = "username already exists" });
     }
     else
     {
         return Json(new { code = "200", msg = "this is a new username" });
     }
 }
예제 #2
0
 public JsonResult validateAccount(ValidateAccountRequest req)
 {
     var _db = new ZestorkContainer();
     if (_db.ValidateUserKeys.Any(x => x.Username == req.userName && x.guid == req.guid))
     {
         Users User = _db.Users.SingleOrDefault(x => x.Username == req.userName);
         User.isActive = "true";
         try
         {
             _db.SaveChanges();
         }
         catch (DbEntityValidationException e)
         {
             dbContextException.logDbContextException(e);
             throw;
         }
         return Json(new { code = "200", msg = "account validated successfully" });
     }
     else
     {
         return Json(new { code = "402", msg = "Link might be expired" });
     }
 }