public ActionResult CreateProject(Project project) { if(project == null) return View("Error"); try { UpdateModel(project); model.Projects.AddObject(project); model.SaveChanges(); return RedirectToAction("Projects"); } catch { return View(project); } }
/// <summary> /// Deprecated Method for adding a new object to the Projects EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToProjects(Project project) { base.AddObject("Projects", project); }
/// <summary> /// Create a new Project object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="summary">Initial value of the Summary property.</param> /// <param name="progress">Initial value of the Progress property.</param> public static Project CreateProject(global::System.Int32 id, global::System.String title, global::System.String summary, global::System.Double progress) { Project project = new Project(); project.ID = id; project.Title = title; project.Summary = summary; project.Progress = progress; return project; }