public IActionResult Create(ProductViewModel product, int[] selectedSuppliers) { if (!ModelState.IsValid) { return(StatusCode(400)); } ViewBag.Suppliers = _supplierManager.GetSuppliers().ToList(); product.Suppliers = _supplierManager.GetSuppliersByIds(selectedSuppliers); _productManager.AddGoods(new List <ProductViewModel> { product }); return(View()); }
public void Post(IEnumerable <ProductViewModel> products) { _productManager.AddGoods(products); }