예제 #1
0
        public async Task <JsonResult> LoginRequest(string email, string password)
        {
            password = password.Encrypt();
            Account account = await _account.FindAsync(x => x.Email.Equals(email) && x.Password.Equals(password));

            if (account != null)
            {
                if (account.Role == RoleUser.Banned)
                {
                    return(Json(new { banned = true }, JsonRequestBehavior.AllowGet));
                }
                Session["Account"] = account;
                return(Json(new { banned = false, success = true }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public async Task <ActionResult> UpdateRole(int accountId, RoleUser role)
        {
            Account account = await _account.FindAsync(x => x.AccountId == accountId);

            account.Role = role;
            bool result = await _account.UpdateAsync(account);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }