Пример #1
0
        public ActionResult DeleteShoeView(int id)
        {
            var allShoesVm = new ShoeListViewModel
            {
                Shoes = _shoesService.GetAllShoes()
            };
            var allBrandsVM = _brandServices.GetAllBrands();


            dynamic myModel = new ExpandoObject();

            myModel.AllShoes = allShoesVm.Shoes;
            myModel.Brand    = allBrandsVM;

            try
            {
                if (ModelState.IsValid)
                {
                    _shoesService.DeleteShoeById(id);
                }
            }
            catch (Exception)
            {
                ViewBag.Error = "Some Error";
            }

            return(View("Index", myModel));
        }
Пример #2
0
 public IActionResult DeleteShoeById(int id)
 {
     _shoesService.DeleteShoeById(id);
     return(Ok());
 }