Пример #1
0
        public IActionResult InsertItem(SaleAdminViewModel saleAdminViewModel, bool?bDisabled)
        {
            if (ModelState.IsValid)
            {
                SaleAdmin saleAdmin = Mapper.Map <SaleAdmin>(saleAdminViewModel);

                _adminService.InsertSale(saleAdmin);
            }

            return(View("Index"));
        }
Пример #2
0
        public async Task InsertItemAsync([FromBody] SaleAdminViewModel saleAdminViewModel)
        {
            if (ModelState.IsValid)
            {
                SaleAdmin saleAdmin      = Mapper.Map <SaleAdmin>(saleAdminViewModel);
                var       searchShopName = Regex.Replace(saleAdmin.NameShop, @"\s+", "").ToLower();

                saleAdmin.FkShop = (await _adminService.GetShopByName(searchShopName))?.Id ?? (await _adminService.InsertShop(saleAdmin.NameShop, searchShopName));

                await _adminService.InsertSaleAsync(saleAdmin);
            }
        }