Пример #1
0
        public async Task <IActionResult> AddStore(ViewModels.PM.Store.AddViewStoreModel addViewStoreModel)
        {
            if (ModelState.IsValid)
            {
                ImageErrorModel imageErrorModel = new ImageErrorModel();
                string          ImagePath       = UploadImage(addViewStoreModel.DefaultImage, ref imageErrorModel);
                if (imageErrorModel.isSuccess)
                {
                    Store store = new Store()
                    {
                        Address      = addViewStoreModel.Address,
                        NameStore    = addViewStoreModel.NameStore,
                        DefaultImage = ImagePath,
                        Description  = addViewStoreModel.Description,
                        DistrictID   = addViewStoreModel.DicstrictID
                    };
                    await StoreBLL.Add(store);

                    return(RedirectToAction("Index"));
                }
            }

            return(View());
        }