public ActionResult ArchiveProject(int?projectId) { var archiveProject = new ArchiveProjectViewModel() { ProjectId = (int)projectId }; return(View(archiveProject)); }
public ActionResult ArchiveProject(ArchiveProjectViewModel formData) { if (formData is null) { return(RedirectToAction("Index")); } var project = ProjectHelper.GetProjectById(DbContext, formData.ProjectId); if (project is null) { return(RedirectToAction("Index")); } project.IsArchived = true; DbContext.SaveChanges(); return(RedirectToAction("Index")); }