Esempio n. 1
0
 public async Task <ActionResult> ActivateUser(string username, string type)
 {
     if (ModelState.IsValid)
     {
         try
         {
             if (type.ToLower().Equals(UserTypes.Doctor.ToString().ToLower()))
             {
                 await _userService.ActiveDoctorAsync(username);
             }
             else if (type.ToLower().Equals(UserTypes.Employee.ToString().ToLower()))
             {
                 await _userService.ActiveEmployeeAsync(username);
             }
             return(RedirectToAction(nameof(ListOfAttempts)));
         }
         catch (Exception ex)
         {
             TempData["message"] = ex.Message;
             return(RedirectToAction(nameof(ListOfAttempts)));
         }
     }
     else
     {
         return(RedirectToAction(nameof(ListOfAttempts)));
     }
 }