public ActionResult Create(Project project) { if (ModelState.IsValid) { project.ConfirmDate = DateTime.Now.Date; context.Projects.Add(project); context.SaveChanges(); // return RedirectToAction("Index"); } ViewBag.PossibleEnquiries = context.Enquiries; return View(project); }
public ActionResult ConfirmProject(int Id) { ViewBag.EnquiryID = Id; TempData["EnquiryIDClient"] = Id; Project p = new Project(); p.EnquiryID = Id; BusinessFlow.Controllers.ProjectsController pdc = new ProjectsController(); try { pdc.Create(p); new JavaScriptResult { Script = "alert('You are done!');" }; } catch { return new JavaScriptResult { Script = "alert('You are not done!');" }; } return View(); }
public void InsertOrUpdate(Project projects) { if (projects.ProjectID == default(int)) { // New entity context.Projects.Add(projects); } else { // Existing entity context.Entry(projects).State = EntityState.Modified; } }
public ActionResult Edit(Project project) { if (ModelState.IsValid) { context.Entry(project).State = EntityState.Modified; context.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PossibleEnquiries = context.Enquiries; return View(project); }