Example #1
0
        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());
        }
Example #2
0
 public void AddProductPublish(ProductPublish publish)
 {
     context.ProductPublish.Add(publish);
     context.SaveChanges();
 }