public JsonResult Edit(BLL.Model.Product product) { try { var valid = TryUpdateModel(product); if (valid) { var products = Operation.UpdateProduct(product); } //return RedirectToAction("Index"); return(Json(new { Valid = valid, Errors = GetErrorsFromModelState(), //StudentsPartial = studentPartialViewHtml })); } catch (Exception ex) { return(Json(new { result = "Error occured" //StudentsPartial = studentPartialViewHtml })); } }
public ActionResult Create(BLL.Model.Product product) { try { // TODO: Add insert logic here var valid = TryUpdateModel(product); if (valid) { var products = Operation.SaveProduct(product); //return RedirectToAction("Index"); //Index(); //return RedirectToAction("Index"); } return(Json(new { Valid = valid, Errors = GetErrorsFromModelState(), //StudentsPartial = studentPartialViewHtml })); } catch { return(View()); } }