public async Task<IHttpActionResult> PostProduct(Product product)
 {
     if (ModelState.IsValid)
     {
         await Repository.SaveProductAsync(product);
         return Ok();
     }
     else {
         return BadRequest(ModelState);
     }
 }
 public async Task<int> SaveProductAsync(Product product)
 {
     if (product.Id == 0)
     {
         context.Products.Add(product);
     }
     else {
         Product dbEntry = context.Products.Find(product.Id);
         if (dbEntry != null)
         {
             dbEntry.Name = product.Name;
             dbEntry.Description = product.Description;
             dbEntry.Price = product.Price;
             dbEntry.Category = product.Category;
         }
     }
     return await context.SaveChangesAsync();
 }
 public async Task<ActionResult> SaveProduct(Product product)
 {
     await repo.SaveProductAsync(product);
     return RedirectToAction("Index");
 }