Exemplo n.º 1
0
        public bool UpdateProductionOrder(int orderId, ProductionOrderFormModel data)
        {
            ProductionOrder orderFromDb = _context.ProductionOrder.Find(orderId);

            if (orderFromDb == null)
            {
                return(false);
            }
            _context.Entry(orderFromDb).CurrentValues.SetValues(data);
            _context.SaveChanges();
            return(true);
        }
Exemplo n.º 2
0
        public ProductionOrderModel CreateProductionOrder(ProductionOrderFormModel data)
        {
            ProductionOrder newOrder = new ProductionOrder();

            _context.ProductionOrder.Add(newOrder);
            _context.Entry(newOrder).CurrentValues.SetValues(data);
            _context.SaveChanges();
            return(new ProductionOrderModel
            {
                Id = newOrder.Id,
                Amount = newOrder.Amount,
                Color = newOrder.Color,
                CustomerOrderId = newOrder.CustomerOrderId,
                DeliveryDate = newOrder.DeliveryDate,
                Motiv = newOrder.Motiv,
                OrderDate = newOrder.OrderDate,
                OrderItem = newOrder.OrderItem,
                OrderPosition = newOrder.OrderPosition,
                ProductionStatusId = 1
            });
        }
Exemplo n.º 3
0
 public bool UpdateProductionOrder(int orderId, [FromBody] ProductionOrderFormModel data)
 {
     return(this._context.UpdateProductionOrder(orderId, data));
 }
Exemplo n.º 4
0
 public ProductionOrderModel CreateProductionOrder([FromBody] ProductionOrderFormModel data)
 {
     return(this._context.CreateProductionOrder(data));
 }