public ActionResult Edit(int id) { var project = ServiceFactory.ProjectService.GetById(id); var model = new ProjectModel { ProjectID = project.ProjectID, Name = project.Name, Description = project.Description, ApplicationUrl = project.ApplicationUrl, DateCreated = project.DateCreated }; return View(model); }
public ActionResult Edit(ProjectModel model) { if (!ModelState.IsValid) { return View(model); } var project = new Project { ProjectID = model.ProjectID, Name = model.Name, ApplicationUrl = model.ApplicationUrl, Description = model.Description, DateCreated = model.DateCreated }; ServiceFactory.ProjectService.Update(project); return RedirectToAction("Index"); }
public ActionResult Add(ProjectModel model) { if (!ModelState.IsValid) { return View(model); } var project = new Project { Name = model.Name, Description = model.Description, ApplicationUrl = model.ApplicationUrl, DateCreated = DateTime.Now }; ServiceFactory.ProjectService.Insert(project); return RedirectToAction("Index"); }