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

            return(View(archiveProject));
        }
Exemple #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"));
        }