public ActionResult EditInfobox(InfoboxViewModel infobox) { InfoBox activeInfobox = infoboxRepository.GetInfoBoxByID(infobox.IdInfoBox); if (activeInfobox != null && activeInfobox.InfoBox1 != null) { activeInfobox.IdCategory = infobox.IdCategory; activeInfobox.InfoBox1 = infobox.InfoBoxDescription; infoboxRepository.SaveChanges(); } return RedirectToAction("ListInfoboxes", "Admin"); }
public ActionResult AddInfobox(InfoboxViewModel infobox) { if (ModelState.IsValid) { InfoBox newInfobox = new InfoBox() { IdCategory = infobox.IdCategory, InfoBox1 = infobox.InfoBoxDescription }; infoboxRepository.CreateNewInfoBox(newInfobox); infoboxRepository.SaveChanges(); return RedirectToAction("ListInfoboxes", "Admin"); } else { return RedirectToAction("AddInfobox", "Admin"); } }