コード例 #1
0
        public async Task EditShopProductAsync(ShopProductParam param)
        {
            var entity = await _shopProductRepository.GetByIdAsync(param.Id);

            entity.ProductName         = param.ProductName;
            entity.PriceProduct        = param.PriceProduct;
            entity.ManufacturerProduct = param.ManufacturerProduct;
            entity.DescriptionProduct  = param.DescriptionProduct;
            entity.IsAvaliable         = param.IsAvaliable == "В наличии";
            entity.TypeProdyctsEnum    = EnumHelper.GetTypeProductsEnum(param.TypeProdycts);

            await _shopProductRepository.SaveChangesAsync();
        }
コード例 #2
0
        public async Task AddNewShopProductAsync(ShopProductParam param)
        {
            ShopProducts entity = new ShopProducts
            {
                ProductName         = param.ProductName,
                PriceProduct        = param.PriceProduct,
                ManufacturerProduct = param.ManufacturerProduct,
                DescriptionProduct  = param.DescriptionProduct,
                IsAvaliable         = param.IsAvaliable == "В наличии",
                TypeProdyctsEnum    = EnumHelper.GetTypeProductsEnum(param.TypeProdycts),
                ShopId = 1
            };

            await _shopProductRepository.AddAsync(entity);
        }
コード例 #3
0
        public async Task <IActionResult> EditShopProduct(ShopProductParam param)
        {
            await productService.EditShopProductAsync(param);

            return(RedirectToAction("ShopProducts"));
        }