public async Task <IActionResult> ApproveClient(string id) { try { if (string.IsNullOrEmpty(id)) { throw new DBConcurrencyException(); } var user = await _userHelper.GetUserByIdAsync(id); if (user == null) { throw new DBConcurrencyException(); } user.IsApproved = true; user.AccountApprovedDate = DateTime.Now; var result = await _userHelper.UpdateUserAsync(user); if (!result.Succeeded) { throw new DBConcurrencyException(); } _mailHelper.SendApproveClient(user.Email, user.Name, user.GuidId); await _notificationRepository.DeleteAsync(await _notificationRepository.GetByGuidIdAsync(user.GuidId)); return(RedirectToAction(nameof(ListUsers))); } catch (DBConcurrencyException) { return(new NotFoundViewResult("_Error404")); } catch (Exception) { return(new NotFoundViewResult("_Error500")); } }