Пример #1
0
        public ActionResult RequestLogin(string username, string password)
        {
            Account account = accountRepository.GetAccountByUsernameAndPassword(username, password);

            if (account == null)
            {
                return(Json(new ReturnResult(400, "Sai tên truy cập hoặc mật khẩu", null), JsonRequestBehavior.AllowGet));
            }
            List <UserPermission> userPermissions = userPermissionRepository.GetUserPermissionsByAccountId(account.Id);

            Session[Constants.USER_SESSION]            = account;
            Session[Constants.USER_PERMISSION_SESSION] = userPermissions;
            return(Json(new ReturnResult(200, "success", null), JsonRequestBehavior.AllowGet));
        }