示例#1
0
        public ActionResult ArchiveProject(int?projectId)
        {
            var archiveProject = new ArchiveProjectViewModel()
            {
                ProjectId = (int)projectId
            };

            return(View(archiveProject));
        }
示例#2
0
        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"));
        }