예제 #1
0
 public async Task <IActionResult> Login([FromBody] Req <AdminModeDto> request)
 {
     if (AdminDto.IsAdminMode() == false)
     {
         //if (string.IsNullOrEmpty(request.OperatorPassword)) { return Error("TryAdminMode"); }
         if (await _adminApplication.CheckPassword(request.OperatorId, request.OperatorPassword, request) == false)
         {
             return(Error("密码不正确"));
         }
         AdminDto.SetAdminMode(DateTime.Now.AddMinutes(request.AdminModeTime));
         SetSession(SessionSetting.AdminSession, AdminDto);
     }
     return(Success());
 }
예제 #2
0
        public async Task <IActionResult> AdminModeEditPost([FromBody] Req <AdminModeEditDto> request)
        {
            if (AdminDto.IsAdminMode() == false && await _adminApplication.GetMenuCheck(ViewData["MenuCode"].ToSafeString(), ViewData["ButtonCode"].ToSafeString()))
            {
                if (string.IsNullOrEmpty(request.OperatorPassword))
                {
                    return(Error("TryAdminMode"));
                }
                if (await _adminApplication.CheckPassword(request.OperatorId, request.OperatorPassword, request) == false)
                {
                    return(Error("密码不正确"));
                }
                AdminDto.SetAdminMode(DateTime.Now.AddMinutes(request.AdminModeTime));
                SetSession(SessionSetting.AdminSession, AdminDto);
            }

            var b = await _adminApplication.EditMenuMode(request);

            if (b == false)
            {
                return(Error(request.Message));
            }
            return(Success());
        }