public async Task<JsonResult> _Create(FormCollection frm)
 {
     Product product = new Product();
     product.CategoryId = int.Parse(frm["category"]);
     product.Name = frm["name"];
     product.Price = decimal.Parse(frm["price"]);
     //product.Count = 0;
     product.WebAvailable = false;
     product.Description = frm["description"];
     await Task.Run(() => ProductService.CreateProduct(product));
     return Json(true);
 }
Beispiel #2
0
 public async void EditProduct(Product product)
 {
     Context.Products.Attach(product);
     Context.Entry(product).State = EntityState.Modified;
     await Context.SaveChangesAsync();
 }
Beispiel #3
0
 public async void CreateProduct(Product product)
 {
     Context.Products.Add(product);
     await Context.SaveChangesAsync();
 }
 public async Task<JsonResult> _Edit(Product product)
 {
     await Task.Run(() => ProductService.EditProduct(product));
     return Json(true);
 }