public ActionResult Product(Shopping.Models.Product product) { product.CreateTime = DateTime.Now; db.Products.Add(product); db.SaveChanges(); var id = db.Products.Max(x => x.ProductID); return(Content(id.ToString())); }
public ActionResult EditProduct(Shopping.Models.Product product) { var result = db.Products.Where(x => x.ProductID == product.ProductID); foreach (var item in result) { item.ProductName = product.ProductName; item.Description = product.Description; item.Postage = product.Postage; } db.SaveChanges(); return(Content("Success")); }