public IActionResult Edit(int?id = null) { AmpComponent ampComponent; if (id.HasValue) { ampComponent = uow.GetRepo <AmpComponentRepository>().GetByID(id.Value); } else { ampComponent = new AmpComponent(); } return(View(ampComponent)); }
public IActionResult Edit(AmpComponent model) { if (ModelState.IsValid) { AmpComponentRepository repo = uow.GetRepo <AmpComponentRepository>(); if (model.ID == 0) { repo.Add(model); } else { repo.Update(model); } return(RedirectToAction("Index")); } return(View(model)); }