Exemple #1
0
 public ActionResult Create(SupplierVM sup)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(View(sup));
         }
         var supplier  = _mapper.Map <Supplier>(sup);
         var isSuccess = _repo.Create(supplier);
         if (!isSuccess)
         {
             ModelState.AddModelError("", "Check for Information");
             return(View(sup));
         }
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("", "Check for Information");
         return(View());
     }
 }