public IActionResult Details(int id, string back) { IssueStepsViewModel model = new IssueStepsViewModel { Back = back, Issue = _db.Issues.FirstOrDefault(i => i.Id == id), DesignatedSteps = _db.IssueStep.OrderBy(i => i.Id).Where(i => i.IssueId == id).Select(s => s.Step) .ToList(), AllSteps = new List <Step>(), DesiredResults = _db.DesiredResultIssue.OrderBy(d => d.Id).Where(d => d.IssueId == id) .Select(s => s.DesiredResult).Where(s => s.Active).ToList() }; return(View(model)); }
public IActionResult AddSteps(int id, string type) { if (id != 0) { IssueStepsViewModel model = new IssueStepsViewModel { Issue = _db.Issues.FirstOrDefault(i => i.Id == id), AllSteps = _db.Steps.OrderByDescending(s => s.CreatedAt).ToList(), DesignatedSteps = _db.IssueStep.OrderBy(i => i.Id).Where(i => i.IssueId == id).Select(s => s.Step) .ToList() }; if (type == "create") { model.Action = "create"; } return(View(model)); } return(NotFound()); }
public IActionResult Edit(int id) { if (id != 0) { IssueStepsViewModel model = new IssueStepsViewModel { Issue = _db.Issues.FirstOrDefault(i => i.Id == id), DesignatedSteps = _db.IssueStep.OrderBy(i => i.Id) .Where(i => i.IssueId == id).Select(s => s.Step) .ToList(), AllSteps = new List <Step>(), DesiredResults = _db.DesiredResultIssue.OrderBy(d => d.Id) .Where(d => d.IssueId == id) .Select(s => s.DesiredResult).Where(s => s.Active).ToList() }; return(View(model)); } return(NotFound()); }
public IActionResult Edit(IssueStepsViewModel model, int choice) { if (ModelState.IsValid) { Issue issue = _db.Issues.FirstOrDefault(i => i.Id == model.Issue.Id); issue.Name = model.Issue.Name; issue.IssueDescription = model.Issue.IssueDescription; _db.Issues.Update(issue); _db.SaveChanges(); if (choice == 2) { return(RedirectToAction("AddSteps", "IssuesManage", new { id = issue.Id })); } if (choice == 3) { return(RedirectToAction("Create", "DesiredResult", new { issuesId = issue.Id })); } } return(RedirectToAction("Details", "IssuesManage", new { id = model.Issue.Id })); }