Exemplo n.º 1
0
 public void CreateOrder(OrderBindingModel model)
 {
     _orderStorage.Insert(new OrderBindingModel
     {
         Date       = model.Date,
         CarId      = model.CarId,
         CustomerId = model.CustomerId,
         EmployeeId = model.EmployeeId
     });
 }
 public void CreateOrder(CreateOrderBindingModel model)
 {
     _orderStorage.Insert(new OrderBindingModel
     {
         ProductId  = model.ProductId,
         Count      = model.Count,
         Sum        = model.Sum,
         DateCreate = DateTime.Now,
         Status     = OrderStatus.Принят
     });
 }
Exemplo n.º 3
0
 public void CreateOrUpdateOrder(OrderBindingModel model)
 {
     if (model.Id.HasValue)
     {
         _orderStorage.Update(model);
     }
     else
     {
         _orderStorage.Insert(new OrderBindingModel
         {
             Students   = model.Students,
             ProviderId = model.ProviderId,
             DateCreate = DateTime.Now
         });
     }
 }
Exemplo n.º 4
0
        public void CreateOrUpdate(OrderBindingModel model)
        {
            var element = _orderStorage.GetElement(new OrderBindingModel
            {
                OrderName = model.OrderName,
                Price     = model.Price
            });

            if (element != null && element.Id != model.Id)
            {
                throw new Exception("Телефон или Email уже был зарегестрирован!");
            }
            if (model.Id.HasValue)
            {
                _orderStorage.Update(model);
            }
            else
            {
                _orderStorage.Insert(model);
            }
        }