public ActionResult Create(Category category) { try { if (ModelState.IsValid) { _db.Categories.Add(category); _db.SaveChanges(); //return RedirectToAction("Index"); //return Content(Boolean.TrueString); return RedirectToAction("Index", "Category"); } //return View(category); //return PartialView("_Create", category); //return Content("Please review your form."); return View("_Create", category); } catch (Exception ex) { //return Content("Error Occured!"); //return RedirectToAction("Index", "Category"); return View("_Create", category); } }
public ActionResult Edit(Category category) { try { if (ModelState.IsValid) { _db.Entry(category).State = EntityState.Modified; _db.SaveChanges(); //return RedirectToAction("Index"); //return Content(Boolean.TrueString); return RedirectToAction("Index", "Category"); } //return View(category); //return PartialView("_Edit", category); //return Content("Please review your form."); return View("_Edit", category); } catch (Exception ex) { //return Content("Error Occured!"); //return RedirectToAction("Index", "Category"); return View("_Edit", category); } }