public IActionResult Details(int id) { OrderVM = new OrderVM() { OrderHeader = _orderHRepo.FirstOrDefault(u => u.Id == id), OrderDetail = _orderDRepo.GetAll(o => o.OrderHeaderId == id, includeProperties: "Product") }; return(View(OrderVM)); }
public IEnumerable <OrderDetail> GetOrderDetails(Int64?id) { if (id == null || id <= 0) { return(orderDetailRepository.GetAll()); } else { return(orderDetailRepository.GetAll().Where(o => o.ID == id)); } }
public IActionResult GetAll(int orderId) { try { var predicate = PredicateBuilder.True <OrderDetail>(); predicate = predicate.And(x => x.Deleted == false && x.OrderId == orderId); var model = orderDetailRepository.GetAll(predicate); var listProducts = new List <ProductDto>(); foreach (var item in model) { var x = productRepository.Get(item.ProductId); listProducts.Add(new ProductDto() { ProductId = x.Id, Name = x.Name, Descripcion = x.Descripcion, Stock = x.Stock, Price = x.Price, WarehouseName = x.Warehouse.Name, WarehouseId = x.WarehouseId }); } return(Ok(listProducts)); } catch (Exception e) { throw e; } }
public IEnumerable <OrderDetailServerDTO> GetOrders() { var orders = new List <OrderDetailServerDTO>(); foreach (var order in orderRepository.GetAll()) { orders.Add(new OrderDetailServerDTO() { Id = order.Id, PaymentStatusId = order.PaymentStatusId, TotalPrice = order.TotalPrice, SubOrderIds = orderDetailRepository.GetAll().Where(o => o.OrderId.Equals(order.Id)).Select(od => od.SubOrderId).ToArray() }); } return(orders); }
public async Task <OrderClientDTO> GetCustomerCurrentOrders(int customerId, int userId, int orderId = 0) { OrderClientDTO orderResult = null; Order order = null; order = orderId > 0 ? orderRepository.GetById(orderId) : orderRepository.GetMany(o => o.CustomerId.Equals(customerId) && o.CreatedBy.Equals(userId) && o.PaymentStatusId.Equals(1)).FirstOrDefault(); //&& order.PaymentStatusId.Equals(1)); if (order != null && order.CustomerId.Equals(customerId) && order.CreatedBy.Equals(userId) && order.PaymentStatusId.Equals(1)) { orderResult = new OrderClientDTO(); orderResult.Id = order.Id; orderResult.PaymentStatusId = order.PaymentStatusId; orderResult.TotalPrice = order.TotalPrice; orderResult.UserId = userId; orderResult.customerId = customerId; foreach (var suborder in orderDetailRepository.GetAll().Where(od => od.OrderId.Equals(orderId) && visibleOrderStatus.Contains(od.OrderStatusId)).ToList()) { if (orderResult.SubOrders == null) { orderResult.SubOrders = new List <OrderDetailClientDTO>(); } var suborderDetail = new OrderDetailClientDTO(); suborderDetail.SubOrderId = suborder.SubOrderId; suborderDetail.OrderStatusId = suborder.OrderStatusId; suborderDetail.SubTotalPrice = 0.00m; foreach (var ordereditem in subOrderDetailRepository.GetAll().Where(o => o.SubOrderId.Equals(suborder.SubOrderId))) { if (suborderDetail.OrderItems == null) { suborderDetail.OrderItems = new List <OrderItemDetailClientDTO>(); } var item = new OrderItemDetailClientDTO(); item.ItemId = ordereditem.ItemId; item.OrderQuantity = ordereditem.OrderQuantity; item.OrderPreferences = ordereditem.OrderPreferences; suborderDetail.OrderItems.Add(item); } orderResult.SubOrders.Add(suborderDetail); } } return(orderResult); }
public async Task <IEnumerable <OrderDetailVm> > GetManyByOrderIdAsync(string orderId) { var OrderDetailVmList = await repo.GetAll() .Include("Product") .Where(x => x.OrderId == orderId) .ToListAsync(); return(OrderDetailVmList.ConvertAllToViewModel()); }
public List <OrderDetail> GetOrderDetails(int orderId) { List <OrderDetail> orderDetails = _orderDetailRepository .GetAll() .Where(od => od.OrderId == orderId) .ToList(); foreach (var od in orderDetails) { od.Shoes = _shoesRepository.GetById(od.ShoesId.Value); od.Shoes.OrderDetail = null; od.Size = _sizeRepository.GetById(od.SizeId.Value); od.Size.OrderDetail = null; } return(orderDetails); }
public BaseViewModel <IEnumerable <OrderDetailViewModel> > UpdateDetail(Guid id, IEnumerable <CreateOrderDetailViewModel> details) { var result = new BaseViewModel <IEnumerable <OrderDetailViewModel> >(); if (details != null) { var listDetail = _orderDetaiRrepository.GetAll().Where(x => x.OrderId == id); foreach (var detail in listDetail) { _orderDetaiRrepository.Delete(detail); } var entities = _mapper.Map <IEnumerable <OrderDetail> >(details); foreach (var entity in entities) { entity.Id = Guid.NewGuid(); entity.SetDefaultInsertValue(_orderDetaiRrepository.GetUsername()); _orderDetaiRrepository.Add(entity); } if (entities == null) { return(new BaseViewModel <IEnumerable <OrderDetailViewModel> >() { Description = MessageHandler.CustomMessage(MessageConstants.NO_RECORD), Code = MessageConstants.NO_RECORD }); } result = new BaseViewModel <IEnumerable <OrderDetailViewModel> > { Data = _mapper.Map <IEnumerable <OrderDetailViewModel> >(entities), }; } Save(); return(result); }
public async Task <ActionResult <IEnumerable <OrdersDto> > > GetOrders() { var ordersCollection = await _orderDetailRepository.GetAll(); // IEnumerable<OrdersDto> numOrder = new List<OrdersDto>(); // IEnumerable<OrderDetails> numOrdDet = new List<OrderDetails>(); // foreach (var order in ordersCollection) // { // var orderId = order.Id; // var od = await _orderDetailRepository.GetByOrderId(orderId); // numOrdDet.Add(); // } // IEnumerable<OrderDetailsDto> listOrderDetails = new List<OrderDetailsDto>(); // foreach (var d in od) // { // var prod = await _productRepository.GetProductById(d.ProductId); // OrderDetailsDto newOdd = new OrderDetailsDto { // Id = d.Id, // OrdersId = d.OrdersId, // ProductId = d.ProductId, // Product = prod, // CartQty = d.CartQty, // ProductPrice = d.productPrice // }; // listOrderDetails.Add(newOdd); // } return(Ok(await _ordersRepository.GetAll())); }
public IEnumerable <OrderDetail> GetAllOrderDetails() { return(_OrderDetailRepository.GetAll()); }
public IHttpActionResult ODGetAll() { var allRecords = odRepo.GetAll(); return(Ok(allRecords)); }
public IEnumerable <OrderDetailView> GetAll(long id) { return(_orderDetail.GetAll(id)); }
public IEnumerable <OrderDetail> GetAll() { return(_orderDetailRepository.GetAll(new string[] { "Warranties", "Orders", "Products" })); }
public IEnumerable <OrderDetail> GetAll(string[] includes = null) { return(_OrderDetailRepository.GetAll()); }
public IEnumerable <OrderDetail> GetAlls(string[] includes, Expression <Func <OrderDetail, bool> > filter) { return(_orderDetail.GetAll(includes, filter)); }
public IQueryable <OrderDetail> GetOrderDetails() { return(_repository.GetAll()); }
public IEnumerable <OrderDetail> GetAll() { return(_orderDetailRepository.GetAll(new string[] { "Order" })); }
public List <OrderDetailListModels> GetListOrderDetail() { return(_OrderDetailRepository.GetAll().ToList().MapToModels()); }
public ICollection <OrderDetail> GetAllWithoutPagination() { return(_orderDetailRepository.GetAll().ToList()); }
public List <OrderDetail> GetAll() { return(oder.GetAll()); }
public IEnumerable <OrderDetailDto> Get(int page = 1, int count = 250) => orderDetailRepository.GetAll(page, count).ToDtoList();