Example #1
0
 public IActionResult AddDimension(AddDimensionModel model)
 {
     if (!ModelState.IsValid)
     {
         return(RedirectToAction("Error", "Home", new { errorType = 2 }));
     }
     if (model.Width == 0 || model.Height == 0 || model.HandleLength == 0 || model.BottomWidth == 0 || model.ProductId == 0)
     {
         return(RedirectToAction("Error", "Home", new { errorType = 3 }));
     }
     _dimensions.AddDimension(new Dimension
     {
         Width        = model.Width,
         Height       = model.Height,
         BottomWidth  = model.BottomWidth,
         HandleLength = model.HandleLength,
         ProductId    = model.ProductId
     });
     return(RedirectToAction("AdminProducts", "Admin"));
 }