public ActionResult Delete(int id, ViewModelProduct collection) { try { // TODO: Add delete logic here var result = _iProductService.Delete(collection); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(ViewModelProduct vproduct) { try { // TODO: Add insert logic here _iProductService.AddProduct(vproduct); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Edit(int id, ViewModelProduct collection) { try { // TODO: Add update logic here _iProductService.InsertOrUpdate(collection); return RedirectToAction("Index"); } catch { return View(); } }
public void AddProduct(ViewModelProduct vproduct) { _iProductRepository.InsertOrUpdate(Mapper.Map<ViewModelProduct, Product>(vproduct)); _iProductRepository.Save(); }
public void InsertOrUpdate(ViewModelProduct vproduct) { try { _iProductRepository.InsertOrUpdate(Mapper.Map<ViewModelProduct, Product>(vproduct)); _iProductRepository.Save(); } catch (Exception e) { } }
public ViewModelProduct Delete(ViewModelProduct vproduct) { try { _iProductRepository.Delete(vproduct.Id); _iProductRepository.Save(); return vproduct; } catch (Exception e) { return null; } }
public ActionResult add(ViewModelProduct vproduct) { _iProductService.AddProduct(vproduct); return RedirectToAction("Index"); }