Exemplo n.º 1
0
        public IActionResult Index()
        {
            var models    = _service.GetAll().ToList();
            var viewModel = _modelBinder.ToViewModel(models);

            return(View(viewModel));
        }
 public Task ActivateAsync(object parameter)
 {
     _currentEmployee = (EmployeeDTO)parameter;
     CategoryDtos     = _mapper.Map <List <Category>, List <CategoryDTO> >(_categoryService.GetAll());
     CategoryFilterComboBox.ItemsSource = CategoryDtos;
     ProductionDtos = _mapper.Map <List <Production>, List <ProductionDTO> >(_productionService.GetAll());
     ManufactureDateFilterComboBox.ItemsSource =
         ProductionDtos.GroupBy(item => item.ManufactureDate).Select(item => item.First());
     UpdateDataGrid();
     return(Task.CompletedTask);
 }
Exemplo n.º 3
0
        private void UpdateDataGrid()
        {
            ProductionDtos = _mapper.Map <List <Production>, List <ProductionDTO> >(_productionService.GetAll());

            ProductionDtos.Sort(delegate(ProductionDTO x, ProductionDTO y)
            {
                return(x.Id.CompareTo(y.Id));
            });

            FilteredProductionDtos = ProductionDtos;

            if (Regex.Match(TitleFilterTextBox.Text, @"^\D{1,20}$").Success)
            {
                var tempList = FilteredProductionDtos.Where(item => item.Title.Contains(TitleFilterTextBox.Text))
                               .ToList();
                FilteredProductionDtos = tempList;
            }

            if (DateFromFilterTextBox.Text != "")
            {
                var tempDate = DateTime.Parse(DateFromFilterTextBox.Text);
                var tempList = FilteredProductionDtos
                               .Where(item => DateTime.Compare(item.ManufactureDate ?? default, tempDate) >= 0).ToList();
                FilteredProductionDtos = tempList;
            }

            if (DateToFilterTextBox.Text != "")
            {
                var tempDate = DateTime.Parse(DateToFilterTextBox.Text);
                var tempList = FilteredProductionDtos
                               .Where(item => DateTime.Compare(item.ManufactureDate ?? default, tempDate) <= 0).ToList();
                FilteredProductionDtos = tempList;
            }

            if (CategoryFilterComboBox.SelectedItem != null)
            {
                var tempCategoty = (CategoryDTO)CategoryFilterComboBox.SelectedItem;
                var tempList     = FilteredProductionDtos.Where(item => item.Category == tempCategoty.Title).ToList();
                FilteredProductionDtos = tempList;
            }

            DataGrid.ItemsSource = FilteredProductionDtos;
        }
Exemplo n.º 4
0
        public IActionResult GetAll()
        {
            var response = _service.GetAll();

            return(Ok(response));
        }
        public ActionResult <IEnumerable <ProductionModel> > Get()
        {
            var items = _service.GetAll();

            return(Ok(items));
        }
Exemplo n.º 6
0
 public async Task <ActionResult <IEnumerable <ProductionModel> > > GetAll()
 {
     return(Ok(_productionService.GetAll()));
 }