コード例 #1
0
        public ActionResult Index()
        {
            BrandListPageViewModel model    = new BrandListPageViewModel();
            FindAllBrandsResponse  response = brandService.FindAllBrands();

            if (response.Success)
            {
                model.BrandViewModels = response.Brands.ConvertToBrandViewModelList();
                model.Success         = true;
            }
            else
            {
                model.Success      = false;
                model.ErrorMessage = response.Message;
            }

            return(View(model));
        }
コード例 #2
0
        public ActionResult Delete(int brandId)
        {
            DeleteBrandRequest  request  = new DeleteBrandRequest();
            DeleteBrandResponse response = new DeleteBrandResponse();

            request.BrandId = brandId;
            response        = brandService.DeleteBrand(request);
            if (response.Success)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                BrandListPageViewModel model = new BrandListPageViewModel();
                model.Success      = false;
                model.ErrorMessage = response.Message;
                return(View("Index", model));
            }
        }