public ActionResult Publish(ProductPublishVM publish) { if (ModelState.IsValid) { ProductPublish productPublish = new ProductPublish(); productPublish.ProdcutID = publish.ProdcutID; productPublish.ProductName = publish.ProductName; productPublish.ProductPrice = publish.ProductPrice; productPublish.Description = publish.Description; productPublish.datePublish = publish.datePublish; context.AddProductPublish(productPublish); var product = context.GetElement(publish.ProdcutID.Value); return(RedirectToAction(nameof(Index), new { manhalID = product.ManhalId })); } return(View()); }
public void AddProductPublish(ProductPublish publish) { context.ProductPublish.Add(publish); context.SaveChanges(); }