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); }
public Entities.Orderitems ParseOrderItems(Models.OrderItems orderItems) { return(new Entities.Orderitems() { Totalitems = orderItems.TotalItems, Productid = orderItems.ProductId, Orderid = orderItems.OrdersId, Id = orderItems.Id }); }
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(); }
public static OrderItems Map(Models.OrderItems order) => new OrderItems { OrderId = order.OrderId, Quantity = order.Quantity, ProductId = order.ProductId };