public async Task <IActionResult> MarkInvalid(string id) { try { await _emailService.ChangeStatusAsync(id, EmailStatus.Invalid); _logger.LogInformation(string.Format(Constants.LogEmailInvalid, User.Identity.Name, id)); TempData[Constants.TempDataMsg] = Constants.EmailInvalidSucc; var allEmails = new List <EmailDto>(); allEmails = await _emailService.GetAllEmailsAsync(); var vm = new AllEmailsViewModel { AllEmails = allEmails.Select(x => x.MapToViewModel()).ToList(), ActiveTab = Constants.TabAll }; return(RedirectToAction("Index", "Email")); } catch (Exception ex) { return(ErrorHandle(ex)); } }
public async Task <IActionResult> MarkAppNew(string id) { try { var emailId = await _appService.GetEmailId(id); await _appService.Delete(id); _logger.LogInformation(string.Format(Constants.LogAppDelete, User.Identity.Name, id)); await _emailService.ChangeStatusAsync(emailId.ToString(), EmailStatus.New); _logger.LogInformation(string.Format(Constants.LogEmailNew, User.Identity.Name, emailId)); TempData[Constants.TempDataMsg] = Constants.AppNewSucc; return(RedirectToAction(Constants.PageGetNewEmails, Constants.PageEmail)); } catch (Exception ex) { return(ErrorHandle(ex)); } }
public async Task ChangeStatusAsync(string id, string appStatus) { try { var currentUser = await this.userManager.GetUserAsync(User); await applicationService.ChangeStatusAsync(id, appStatus); await emailService.ChangeStatusAsync(id, EmailStatusesEnum.Closed, currentUser); await this.hubContext.Clients.All.SendAsync("UpdateChart", "Closed", "Open"); } catch { throw new Exception(); } }