public ActionResult Add(Category category) { try { if (ModelState.IsValid) { //_db.Categories.Add(category); //_db.SaveChanges(); return Content(GetReturnAppWindow(Boolean.TrueString, "success", "Add Successfully.")); } //return View(category); //return PartialView("_Create", category); return Content(GetReturnAppWindow(Boolean.FalseString, "warn", "Please review your form.")); } catch (Exception ex) { return Content(GetReturnAppWindow(Boolean.FalseString, "error", "Error Occured!")); } }
public ActionResult Add(Category category) { try { if (ModelState.IsValid) { _db.Categories.Add(category); _db.SaveChanges(); //return RedirectToAction("Index"); return Content(Boolean.TrueString); } //return View(category); //return PartialView("_Add", category); return Content("Please review your form."); } catch (Exception ex) { return Content("Error Occured!"); } }
public JsonResult MasterDetailsSave(Category model, List<Product> modelList) { try { if (ModelState.IsValid) { if (model != null) { if (modelList.Any()) { //Save MasterDetails Data //Save MasterDetails Data return Json(new { msg = "Master details saved successfully.", status = MessageType.success.ToString() }, JsonRequestBehavior.AllowGet); } else { //Details Data Null Message return Json(new { msg = "Details data could not found.", status = MessageType.success.ToString() }, JsonRequestBehavior.AllowGet); } } else { //Master Data Null Message return Json(new { msg = "Master data could not found.", status = MessageType.success.ToString() }, JsonRequestBehavior.AllowGet); } } //ModelState Validation return Json(new { msg = ExceptionHelper.ModelStateErrorFormat(ModelState), status = MessageType.info.ToString() }, JsonRequestBehavior.AllowGet); } catch (Exception ex) { return Json(new { msg = ExceptionHelper.ExceptionMessageFormat(ex, log: false), status = MessageType.error.ToString() }, JsonRequestBehavior.AllowGet); } }
public ActionResult Update(Category category) { if (ModelState.IsValid) { _db.Entry(category).State = EntityState.Modified; _db.SaveChanges(); return RedirectToAction("PopUp"); } return View("PopUp"); }
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 View(category); //return PartialView("_Edit", category); return Content("Please review your form."); } catch (Exception ex) { return Content("Error Occured!"); } }
public ActionResult Create(Category category) { if (ModelState.IsValid) { _db.Categories.Add(category); _db.SaveChanges(); return RedirectToAction("PopUp"); } return View("PopUp"); }
public ActionResult Add() { var category = new Category(); return PartialView("_Add", category); }