Exemplo n.º 1
0
        public async Task <IActionResult> Approve(string id)
        {
            try
            {
                await _appService.ChangeStatusAsync(id, ApplicationStatus.Approved, User.Identity.Name);

                _logger.LogInformation(string.Format(Constants.LogAppApproved, User.Identity.Name, id));

                var emailId = await _appService.GetEmailId(id);

                await _emailService.ChangeStatusAsync(emailId, EmailStatus.Closed);

                _logger.LogInformation(string.Format(Constants.LogEmailClosed, User.Identity.Name, emailId));

                TempData[Constants.TempDataMsg] = Constants.AppValidSucc;

                return(RedirectToAction(Constants.PageGetClosedEmails, Constants.PageEmail));
            }
            catch (Exception ex)
            {
                return(ErrorHandle(ex));
            }
        }
Exemplo n.º 2
0
        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();
            }
        }