예제 #1
0
        public ActionResult Create(Project project)
        {
            try
            {
                // TODO: Add insert logic here
                project.ProfileRefId = 1;
                db.Projects.Add(project);

                return RedirectToAction("Portfolio","Home");
            }
            catch
            {
                return View("~/Views/Shared/Error.cshtml");
            }
        }
예제 #2
0
        public ActionResult Edit(Project modifiedProject)
        {
            try
            {
                // TODO: Add update logic here
                Project prjToUpdate = db.Projects.Find(modifiedProject.ProjectId);

                if (prjToUpdate != null)
                {
                    prjToUpdate.ProjectDescription = modifiedProject.ProjectDescription;
                    prjToUpdate.ProjectMembers = modifiedProject.ProjectMembers;
                    prjToUpdate.ProjectName = modifiedProject.ProjectName;
                    prjToUpdate.ProjectRole = modifiedProject.ProjectRole;
                    prjToUpdate.ProjectSize = modifiedProject.ProjectSize;
                    prjToUpdate.SizeUnit = modifiedProject.SizeUnit;

                    db.SaveChanges();

                    return RedirectToAction("Portfolio", "Home");
                }
                else
                {
                    return RedirectToAction("Portfolio", "Home");
                }
            }
            catch
            {
                return View("~/Views/Shared/Error.cshtml");
            }
        }