public async Task <IActionResult> AdoptReject(int Id, [Bind("Id, CustomerProblem,ProblemDescription,Status,ProductOwner,Links,BootcampAssigned,SolutionDescription,AdoptedBy, AdoptionValue, AdoptionReason")] AdoptRequestModel adoptRequestModel) { if (ModelState.IsValid) { if (Id != adoptRequestModel.Id) { return(NotFound()); } try { string userEmail = HttpContext.User.Claims.ToList()[2].Value; await _backlogUow.RejectAdoption(adoptRequestModel, userEmail); } catch (DbUpdateConcurrencyException) { if (!await _backlogUow.IsBackLogItemExistsAsync(adoptRequestModel.Id)) { return(NotFound()); } throw; } return(RedirectToAction(nameof(Index))); } return(RedirectToAction(nameof(Index))); }
public async Task AdoptIdeaAsync(AdoptRequestModel adoptRequestModel, string userEmail) { var backlogiem = await _context.BackLogs.FirstAsync(x => x.Id == adoptRequestModel.Id); if (backlogiem != null) { backlogiem.AdoptedBy = adoptRequestModel.AdoptedBy; backlogiem.AdoptionValue = adoptRequestModel.AdoptionValue; backlogiem.AdoptionReason = adoptRequestModel.AdoptionReason; backlogiem.AdoptionEmailAddress = userEmail; backlogiem.Status = adoptRequestModel.Status; _context.Update(backlogiem); await _context.SaveChangesAsync(); _emailSender.SendAdoptionEmail(userEmail); } }
public async Task RejectAdoption(AdoptRequestModel adoptRequestModel, string userEmail) { var backlogItem = await _context.BackLogs.FirstAsync(x => x.Id == adoptRequestModel.Id); backlogItem.Status = IdeaStatuses.ProjectAdoptable; backlogItem.AdoptedBy = string.Empty; backlogItem.AdoptionValue = string.Empty; backlogItem.AdoptionReason = string.Empty; _context.Update(backlogItem); await _context.SaveChangesAsync(); if (string.IsNullOrEmpty(backlogItem.AdoptionEmailAddress)) { backlogItem.AdoptionEmailAddress = userEmail; } _emailSender.SendAdoptionRejectionEmail(backlogItem.AdoptionEmailAddress); }