public ActionResult Edit(int?id, Software_Requirement model) { model.id = id ?? -1; try { if (id == null) { rs.InsertRequirement(model); return(RedirectToAction("Index")); } else { rs.UpdateRequirement(model); return(RedirectToAction("Details", new { id = model.id })); } } catch { return(View(model)); } }