public Category AddCategory(Category category) { var categoryData = new Category { Name = category.Name, Products = category.Products }; _context.Categorys.Add(categoryData); _context.SaveChanges(); return(category); }
public Customer AddCustomer(Customer customer) { var customerData = new Customer { Address = customer.Address, Logins = customer.Logins, Name = customer.Name, }; _context.Customers.Add(customerData); _context.SaveChanges(); return(customerData); }
public DeliveryAddress AddDeliveryAddress(DeliveryAddress deliveryAddress) { var deliveryAddressData = new DeliveryAddress { Name = deliveryAddress.Name, Address = deliveryAddress.Address, Orders = deliveryAddress.Orders }; _context.DeliveryAddresss.Add(deliveryAddressData); _context.SaveChanges(); return(deliveryAddress); }
public Order AddOrder(Order order) { var orderData = new Order { CustomerId = order.CustomerId, DeliveryAddressId = order.DeliveryAddressId, OrderItems = order.OrderItems }; _context.Orders.Add(orderData); _context.SaveChanges(); return(order); }
public OrderItem AddOrderItem(OrderItem orderItem) { var orderItemData = new OrderItem { OrderId = orderItem.OrderId, ProductId = orderItem.ProductId, Quantity = orderItem.Quantity }; _context.OrderItems.Add(orderItemData); _context.SaveChanges(); return(orderItem); }
public Product AddProduct(Product product) { var productData = new Product { CategoryId = product.CategoryId, Name = product.Name, OrderItems = product.OrderItems, Price = product.Price }; _context.Products.Add(productData); _context.SaveChanges(); return(product); }