public async Task <IActionResult> DeclineClient(string id) { try { if (string.IsNullOrEmpty(id)) { throw new DBConcurrencyException(); } var user = await _userHelper.GetUserByGuidIdAsync(id); if (user == null) { return(new NotFoundViewResult("_Error404")); } var result = await _userHelper.DeleteUserAsync(user); if (!result.Success) { throw new DBConcurrencyException(); } _mailHelper.SendRefuseClient(user.Email, user.Name); await _notificationRepository.DeleteAsync(await _notificationRepository.GetByGuidIdAsync(user.GuidId)); return(RedirectToAction(nameof(ListUsers))); } catch (DBConcurrencyException) { return(new NotFoundViewResult("_Error404")); } catch (Exception) { return(new NotFoundViewResult("_Error500")); } }