Exemplo n.º 1
0
        public ActionResult Find(OrdersRequestViewModel request)
        {
            var customerRequest = new CustomersRequest();

            if (request.CustomersRequest == null)
            {
                customerRequest = null;
            }
            else
            {
                customerRequest.FirstName = request.CustomersRequest.FirstName;
                customerRequest.LastName  = request.CustomersRequest.LastName;
            }

            var managerRequest = new ManagersRequest();

            if (request.ManagersRequest == null)
            {
                managerRequest = null;
            }
            else
            {
                managerRequest.LastName = request.ManagersRequest.LastName;
            }

            var orderRequest = new OrdersRequest()
            {
                Cost             = request.Cost,
                CustomersRequest = customerRequest,
                ManagersRequest  = managerRequest
            };

            return(PartialView("_OrdersTable",
                               Mapper.Map <IEnumerable <OrderViewModel> >(_service.GetOrders(orderRequest))));
        }
Exemplo n.º 2
0
        public ActionResult Find(ManagersRequestViewModel request)
        {
            var customerRequest = new ManagersRequest()
            {
                LastName = request.LastName
            };

            return(PartialView("_ManagersTable",
                               Mapper.Map <IEnumerable <ManagerViewModel> >(_service.GetManagers(customerRequest))));
        }
Exemplo n.º 3
0
        public IEnumerable <ManagerDTO> GetManagers(ManagersRequest request = null)
        {
            Expression <Func <ManagerDTO, bool> > finalExpression;

            if (request == null || request.LastName == null)
            {
                finalExpression = null;
            }
            else
            {
                finalExpression = x => x.LastName == request.LastName;
            }

            using (var unitOfWork = _factory.GetInstance())
            {
                return(unitOfWork.GetManagers(finalExpression));
            }
        }