Пример #1
0
        public async Task <OrderItemDto> AddOrderItemAsync(OrderItemDto orderItem)
        {
            Models.OrderItems newOrderItem = this._mapper.Map <Models.OrderItems>(orderItem);
            await this._dbContext.OrderItems.AddAsync(newOrderItem);

            await this._dbContext.SaveChangesAsync();

            return(orderItem);
        }
Пример #2
0
 public Entities.Orderitems ParseOrderItems(Models.OrderItems orderItems)
 {
     return(new Entities.Orderitems()
     {
         Totalitems = orderItems.TotalItems,
         Productid = orderItems.ProductId,
         Orderid = orderItems.OrdersId,
         Id = orderItems.Id
     });
 }
Пример #3
0
        public void AddOrderItems(int orderId, int productId)
        {
            var orderItems = new Models.OrderItems();

            orderItems.OrderId   = orderId;
            orderItems.ProductId = productId;
            orderItems.Quantity  = 0;

            _dbContext.Add(Mapping.Map(orderItems));
            _dbContext.SaveChanges();
        }
Пример #4
0
 public static OrderItems Map(Models.OrderItems order) => new OrderItems
 {
     OrderId   = order.OrderId,
     Quantity  = order.Quantity,
     ProductId = order.ProductId
 };