Пример #1
0
        public IEnumerable <OrderViewModel> GetOrders()
        {
            var orders = Mapper.Map <IEnumerable <OrderViewModel> >(_iOrderRepository.Getorders().ToList()).ToList();

            for (int i = 0; i < orders.Count(); i++)
            {
                orders[i].Comment = _iRemarksRepository.GetRemarkById(orders[i].OrderId).ToList().LastOrDefault().Comment;
            }
            return(orders);
        }
Пример #2
0
 public IEnumerable <ExportOrderViewModel> ExportGetAll(int Id, int roleId)
 {
     if (roleId == 1)
     {
         var orders = _iOrderRepository.Getorders().UseAsDataSource(Mapper.Configuration).For <ExportOrderViewModel>().ToList();
         for (int i = 0; i <= orders.ToList().Count - 1; i++)
         {
             orders[i].Comment            = _iRemarksRepository.GetRemarkById(orders[i].OrderId).FirstOrDefault().ToString();
             orders[i].CurrentStatusValue = _iDataService.GetOrdersStatus().Where(m => m.ID == orders[i].CurrentStatus).FirstOrDefault().ToString();
         }
         return(orders);
     }
     else
     {
         var orders = _iOrderRepository.Getorders().Where(m => m.EID == Id).UseAsDataSource(Mapper.Configuration).For <ExportOrderViewModel>().ToList();
         for (int i = 0; i <= orders.ToList().Count - 1; i++)
         {
             orders[i].Comment            = _iRemarksRepository.GetRemarkById(orders[i].OrderId).FirstOrDefault().ToString();
             orders[i].CurrentStatusValue = _iDataService.GetOrdersStatus().Where(m => m.ID == orders[i].CurrentStatus).FirstOrDefault().ToString();
         }
         return(orders);
     }
 }