public VocalBase VocalEditForm(VocalEditForm newItem) { var o = ds.VocalClass.Find(newItem.Id); if (o == null) { return(null); } ds.Entry(o).CurrentValues.SetValues(newItem); ds.SaveChanges(); return(mapper.Map <VocalBase>(o)); }
public ActionResult Edit(int?id, VocalEditForm newItem) { if (!ModelState.IsValid) { return(RedirectToAction("edit", new { id = newItem.Id })); } if (id.GetValueOrDefault() != newItem.Id) { return(RedirectToAction("index")); } var editedItem = m.VocalEditForm(newItem); if (editedItem == null) { return(RedirectToAction("edit", new { id = newItem.Id })); } else { return(RedirectToAction("details", new { id = newItem.Id })); } }