public ActionResult Create(ProductSoldDto dto) { ProductSold productSold = ProductSold.Of(productId: dto.product_id, customerId: dto.customer_id, storeId: dto.store_id); productSoldService.Save(productSold); return(Content(toJson(productSold))); }
// GET: Stores/Details/5 public ActionResult Update(int?id, ProductSoldDto dto) { var productSold = productSoldService.FindOne(id.Value); if (productSold == null) { return(HttpNotFound($"id ${id} not found")); } try { return(toContent(productSoldService.Update(productSold, productId: dto.product_id, customerId: dto.customer_id, storeId: dto.store_id, dateSold: dto.date_sold))); } catch (DbEntityValidationException e) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, e.Message)); } }