示例#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.Принят
     });
 }
示例#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
         });
     }
 }
示例#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);
            }
        }