コード例 #1
0
        public async Task ChangeProductSupplier(ChangeProductSupplierModel changeProductSupplierModel)
        {
            var product   = this.context.Products.Where(x => x.Id == changeProductSupplierModel.ProductId).FirstOrDefault();
            var suppliers = await GetSupplierNames();

            product.Supplier = suppliers[changeProductSupplierModel.NewSupplierIndex].Name;
            this.context.Products.Update(product);
            await this.context.SaveChangesAsync();
        }
コード例 #2
0
        public async Task <IActionResult> ChangeSupplierToProduct(ChangeProductSupplierModel changeProductSupplierModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            await this.productService.ChangeProductSupplier(changeProductSupplierModel);

            return(RedirectToAction("ChangeProductSupplier"));
        }