Example #1
0
        public Guid AddOrder(OrderDTO orderModel)
        {
            Order dataModel = new Order();

            orderModel.CopyTo(dataModel);
            _context.Orders.Add(dataModel);
            _context.SaveChanges();
            return(dataModel.Id);
        }
Example #2
0
        public void UpdateOrder(OrderDTO orderModel)
        {
            Order dataModel = _context.Orders.Include(x => x.PricelistOrders).FirstOrDefault(x => x.Id == orderModel.Id);

            if (dataModel == null)
            {
                return;
            }
            orderModel.CopyTo(dataModel);
            //_context.Entry(dataModel).State = System.Data.Entity.EntityState.Modified;
            _context.SaveChanges();
            return;
        }
Example #3
0
 public static Order ToOrder(this OrderDTO dto) => dto?.CopyTo(new Order());