public ActionResult Add(ProductModel model) { if (ModelState.IsValid) { var product = Mapper.Map<Product>(model); var result = ProductService.AddProduct(product); if (result.Succes) { return RedirectToAction("List"); } } return View(model); }
public JsonResult GetProductByEanAjax(string ean) { var model = new ProductModel(); try { var product = ProductService.GetProductByEan(ean); if (product != null) { model = Mapper.Map<ProductModel>(product); model.SetSucces(); } else { model.SetError(String.Format(ResProduct.NoProductForEan, ean)); } } catch (Exception ex) { model.SetError(ex); } return Json(model, JsonRequestBehavior.AllowGet); }
public ActionResult Update(ProductModel model) { return RedirectToAction("List"); }
// GET: Product public ActionResult Add() { var model = new ProductModel(); return View(model); }