Exemple #1
0
        public CreateSaleViewModel Create()
        {
            var employees = _employeesQuery.Execute();

            var customers = _customersQuery.Execute();

            var products = _productsQuery.Execute();

            var viewModel = new CreateSaleViewModel();

            viewModel.Employees = employees
                                  .Select(p => new SelectListItem()
            {
                Value = p.Id.ToString(),
                Text  = p.Name
            })
                                  .ToList();

            viewModel.Customers = customers
                                  .Select(p => new SelectListItem()
            {
                Value = p.Id.ToString(),
                Text  = p.Name
            })
                                  .ToList();

            viewModel.Products = products
                                 .Select(p => new SelectListItem()
            {
                Value = p.Id.ToString(),
                Text  = p.Name + " ($" + p.UnitPrice + ")"
            })
                                 .ToList();

            viewModel.Sale = new CreateSaleModel();

            return(viewModel);
        }
Exemple #2
0
        public ViewResult Index()
        {
            var customers = _query.Execute();

            return(View(customers));
        }
 public async Task <IEnumerable <CustomerListModel> > Get()
 {
     return(await _getCustomersListQuery.Execute());
 }
        public async Task <IActionResult> Get()
        {
            var customers = await _query.Execute();

            return(Ok(customers));
        }
 public List <CustomerModel> Handle(GetCustomersListQuery1 message)
 {
     return(_query.Execute().ToList());
 }
 public IEnumerable <CustomerModel> Get()
 {
     return(_query.Execute());
 }