public ActionResult Edit(int id, Project project) { return SaveProject(project); }
// // POST: /Projects/Delete/5 private ActionResult SaveProject(Project project) { var existingProject = _projectRepo.GetProject(project.ProjectName); if (existingProject != null && project.ProjectId != existingProject.ProjectId) ModelState.AddModelError("ProjectName", "Project name is already used"); if (!ModelState.IsValid) return View(project); if (existingProject != null) { existingProject.Description = project.Description; _projectRepo.SaveProject(existingProject); } else _projectRepo.SaveProject(project); return RedirectToAction("Index"); }
public ActionResult Create(Project project) { return SaveProject(project); }