public object get_and_set_product_data(int Id) { OrderProductInputModel = get_order_product_and_populate_input_model(Id); return(new { Id = OrderProductInputModel.Id, ProductName = OrderProductInputModel.ProductName, Description = OrderProductInputModel.Description }); }
public List <EntityLibrary.OrderModels.OrderProductsInputModel> GetOrderProductsByOrderIdAndCustomerId(int OrderId, int CustomerId) { var result = from o in db.Orders join oi in db.OrderItems on o.Id equals oi.OrderId join op in db.OrderProducts on oi.OrderProductID equals op.Id where o.CustomerId == CustomerId && o.Id == OrderId select new { ProductName = op.ProductName, Description = op.Description, Quantity = oi.Quantity, Id = op.Id }; List <EntityLibrary.OrderModels.OrderProductsInputModel> OrderProductsOverView = new List <EntityLibrary.OrderModels.OrderProductsInputModel>(); foreach (var Products in result) { OrderProductInputModel = new EntityLibrary.OrderModels.OrderProductsInputModel(); OrderProductInputModel.Id = Products.Id; OrderProductInputModel.ProductName = Products.ProductName; OrderProductInputModel.Description = Products.Description; OrderProductInputModel.Quantity = Products.Quantity; OrderProductsOverView.Add(OrderProductInputModel); } return(OrderProductsOverView); }
public OrderItem Populate_Order_Items_Other_Products(EntityLibrary.OrderModels.OrderProductsInputModel OrderProducts, int OrderNo, int OrderProductID) { OrderItem.Quantity = OrderProducts.Quantity; OrderItem.OrderProductID = OrderProductID; OrderItem.OrderId = OrderNo; return(OrderItem); }
public int Add_Other_Product_And_Return_Generated_ID(EntityLibrary.OrderModels.OrderProductsInputModel OtherRequestProduct) { OrderProduct.ProductName = OtherRequestProduct.ProductName; OrderProduct.Description = OtherRequestProduct.Description; db.OrderProducts.Add(OrderProduct); db.SaveChanges(); return(OrderProduct.Id); }
public List <EntityLibrary.OrderModels.OrderProductsInputModel> Populated_Order_Product_From_Request(EntityLibrary.OrderModels.OrderRequestInputModel OrderInputRequest) { List <EntityLibrary.OrderModels.OrderProductsInputModel> OrderInput = new List <EntityLibrary.OrderModels.OrderProductsInputModel>(); if (OrderInputRequest.Id != null) { for (int counter = 0; counter < OrderInputRequest.Id.Count(); counter++) { if (OrderInputRequest.ProductName[counter] != null && OrderInputRequest.ProductName[counter].Trim() != "" && OrderInputRequest.Description[counter] != null && OrderInputRequest.Description[counter].Trim() != "") { OrderProductInputModel = new EntityLibrary.OrderModels.OrderProductsInputModel(); OrderProductInputModel.Id = OrderInputRequest.Id[counter]; OrderProductInputModel.ProductName = OrderInputRequest.ProductName[counter]; OrderProductInputModel.Description = OrderInputRequest.Description[counter]; OrderProductInputModel.Quantity = OrderInputRequest.Quantity[counter]; OrderInput.Add(OrderProductInputModel); } } return(OrderInput); } return(OrderInput); }
public EntityLibrary.OrderModels.OrderProductsInputModel PopulateTemporaryStorage(EntityLibrary.OrderModels.OrderProductsInputModel OrderProductsRequestedInput) { OrderProductInputModel.Id = OrderProductsRequestedInput.Id; OrderProductInputModel.ProductName = OrderProductsRequestedInput.ProductName; OrderProductInputModel.Description = OrderProductsRequestedInput.Description; OrderProductInputModel.Quantity = OrderProductsRequestedInput.Quantity; return(OrderProductInputModel); }