public void InsertOrUpdate(Project project) { if (project.ProjectId == default(int)) { // New entity context.Projects.Add(project); } else { // Existing entity context.Entry(project).State = EntityState.Modified; } }
public ProjectModel Create(Project project) { return new ProjectModel() { ProjectId = project.ProjectId, Name = project.Name, Code = project.Code, Lead = project.ApplicationUser.UserName, Category = project.ProjectCategory.Name }; }
public ActionResult Create(Project project) { if (ModelState.IsValid) { db.Projects.Add(project); db.SaveChanges(); //return RedirectToAction("Index"); return this.RedirectToAction<ProjectController>(c => c.Index()); } ViewBag.LeadId = new SelectList(db.Users, "Id", "UserName", project.LeadId); ViewBag.ProjectCategoryId = new SelectList(db.ProjectCategories, "Id", "Name", project.ProjectCategoryId); return View(project); }
public void InsertGraph(Project entity) { throw new NotImplementedException(); }