public ActionResult Create(ProductCRVM newProduct)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _storeBL.AddProduct(_mapper.cast2Product(newProduct));
             return(RedirectToAction(nameof(Index)));
         }
         catch
         {
             return(View());
         }
     }
     return(View());
 }
Esempio n. 2
0
 public ActionResult Create(ProductCRVM newProduct)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _partsBL.AddProduct(_mapper.cast2Product(newProduct));
             return(RedirectToAction(nameof(Index)));
         }
         catch
         {
             Log.Warning("Unable to create Product");
             return(RedirectToAction(nameof(Index)));
         }
     }
     else
     {
         return(RedirectToAction(nameof(Index)));
     }
 }
Esempio n. 3
0
 public ActionResult Create(ProductCRVM newProduct)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _productBL.AddProduct(_mapper.cast2Product(newProduct));
             //Helper.WriteInformation($"Product created-- Email: {newProduct.ProductEmail}");
             Log.Information($"Product created-- Name: {newProduct.ProdName}");
             return(RedirectToAction(nameof(Index)));
         }
         catch (Exception e)
         {
             Helper.WriteError(e, "Error");
             Helper.WriteFatal(e, "Fatal");
             Helper.WriteVerbose(e, "Verbose");
             return(View());
         }
         finally
         {
         }
     }
     return(View());
 }