public ActionResult Edit(OrganizationVM organizationVM) { try { if (ModelState.IsValid) { Organization organization = new Organization(); organization.Id = organizationVM._Id; if (organizationVM._name != null) { organization.name = organizationVM._name; } if (organizationVM._status == true) { organization.status = 1; } else { organization.status = 0; } db.Entry(organization).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(organizationVM)); } catch { return(View("Error")); } }
public ActionResult Edit(ProjectVM projectVM) { try { if (ModelState.IsValid) { Project project = new Project(); project.Id = projectVM._Id; //Checking for name if (projectVM._name != null) { project.name = projectVM._name; } //Checking for beginDate if (projectVM._beginDate != null) { project.beginDate = projectVM._beginDate; } //Checking for description if (projectVM._description != null) { project.description = projectVM._description; } else { project.description = ""; } //Checking for status if (projectVM._status == true) { project.status = 1; } else { project.status = 0; } db.Entry(project).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(projectVM)); } catch { return(View("Error")); } }