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

            }
        }
Exemplo n.º 6
0
 public ViewModelProduct Delete(ViewModelProduct vproduct)
 {
     try
     {
         _iProductRepository.Delete(vproduct.Id);
         _iProductRepository.Save();
         return vproduct;
     }
     catch (Exception e)
     {
         return null;
     }
 }
Exemplo n.º 7
0
 public ActionResult add(ViewModelProduct vproduct)
 {
     _iProductService.AddProduct(vproduct);
     return RedirectToAction("Index");
 }