Пример #1
0
        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)));
        }
Пример #2
0
        // 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));
            }
        }