Exemplo n.º 1
0
        // GET: Manufacturer
        public ActionResult Index(int id = 1)
        {
            Session["LastPage"] = id;

            int countOfPages = (int)Math.Ceiling((double)(repo.GetAll().ToList().Count) / countPerPage);

            ViewBag.Manufacturers = repo.GetAll()
                                    .ToList()
                                    .Skip((id - 1) * countPerPage)
                                    .Take(countPerPage);
            ViewBag.CountOfPages = countOfPages;
            return(View());
        }
Exemplo n.º 2
0
        public void TestManufacturerRepo_GetAll()
        {
            //Arrange
            ManufacturerRepository TestRepo = CreateManufacturerTestRepo("ManufacturerGetAll");

            //Act
            var result = TestRepo.GetAll();

            //Assert
            Assert.IsTrue(result.Count() == _ManufacturerNumber);
        }
Exemplo n.º 3
0
 public void SetValues()
 {
     ManufacturerComboBox.ItemsSource = ManufacturerRepository.GetAll();
     CategorieComboBox.ItemsSource    = CategorieRepository.GetAll();
     ManufacturerComboBox.Text        = Product.Manufacturer.name;
     CategorieComboBox.Text           = Product.Categorie.name;
     NameTextBox.Text  = Product.name;
     PriceTextBox.Text = Product.price.ToString();
     ManufacturedDatePiker.SelectedDate = Product.manufacturedDate;
     ImportDatePiker.SelectedDate       = Product.importDate;
 }
Exemplo n.º 4
0
        public ActionResult Manufacturers(int id = 1)
        {
            var manufacturers           = _manufacturers.GetAll();
            var countPagesManufacturers = GetCountPages(manufacturers.Count());

            ViewBag.Manufacturers = manufacturers
                                    .Skip((id - 1) * _perPage)
                                    .Take(_perPage);
            ViewBag.CouuntPagesManufacturers = countPagesManufacturers;

            return(View());
        }
Exemplo n.º 5
0
        public HomeController()
        {
            repo = new GoodRepository();

            manufRepo = new ManufacturerRepository();
            catRepo   = new CategoryRepository();

            Manufs = manufRepo.GetAll().ToList();
            Cats   = catRepo.GetAll().ToList();

            ViewBag.Manufs = Manufs;
            ViewBag.Cats   = Cats;
        }
Exemplo n.º 6
0
        public IEnumerable <ManufacturerModel> GetAll()
        {
            var manufacturers      = manufacturerRepository.GetAll();
            var manufactererModels = manufacturers.Select(x => new ManufacturerModel
            {
                Name    = x.Name,
                Details = x.Details.Select(y => new DetailModel
                {
                    Price          = y.Price,
                    CarId          = y.CarId,
                    ManufacturerId = y.ManufacturerId,
                    TypeId         = y.TypeId
                }).ToList(),
                Cars = x.Cars.Select(y => new CarModel
                {
                    Model          = y.Model,
                    ManufacturerId = y.ManufacturerId
                }).ToList()
            });

            return(manufactererModels);
        }
Exemplo n.º 7
0
 private void Fill(GoodViewModel goodViewModel)
 {
     goodViewModel.Filters = new List <Filtration>();
     foreach (var category in categoryRepository.GetAll())
     {
         goodViewModel.Filters.Add(new Filtration {
             CategoryId = category.CategoryId, CategoryName = category.CategoryName
         });
     }
     foreach (var manufacturer in manufacturerRepository.GetAll())
     {
         goodViewModel.Filters.Add(new Filtration {
             ManufacturerId = manufacturer.ManufacturerId, ManufacturerName = manufacturer.ManufacturerName
         });
     }
 }
Exemplo n.º 8
0
        public GoodController()
        {
            ViewBag.Categories = _categories.GetAll()
                                 .ToList()
                                 .Select(x => new SelectListItem()
            {
                Value = x.CategoryId.ToString(),
                Text  = x.CategoryName
            }).ToList();

            ViewBag.Manufacturers = _manufacturers.GetAll()
                                    .ToList()
                                    .Select(uc => new SelectListItem()
            {
                Value = uc.ManufacturerId.ToString(),
                Text  = uc.ManufacturerName
            })
                                    .ToList();
        }
 public IEnumerable <Manufacturer> GetAll()
 {
     return(manufacturerRepository.GetAll());
 }
 // GET: Manufacturers
 //Show all manufacturers.
 public async Task <IActionResult> Index()
 {
     return(View(await _manufacturerRepository.GetAll().ToListAsync()));
 }
Exemplo n.º 11
0
 public void SetManufacturerAndCategorieComboBox()
 {
     ManufacturerComboBox.ItemsSource = ManufacturerRepository.GetAll();
     CategorieComboBox.ItemsSource    = CategorieRepository.GetAll();
 }
Exemplo n.º 12
0
 // GET: Manufacturer
 public ActionResult Index()
 {
     return(View(manufacturerRepository.GetAll()));
 }
Exemplo n.º 13
0
 public ActionResult Manufacturers(int id = 1)
 {
     ViewBag.CouuntPagesManufacturers = GetCountPages(_manufacturers.GetAll().Count());
     return(View());
 }
Exemplo n.º 14
0
 public List <ManufacturerListModel> GetAll()
 {
     return(mapper.Map <List <ManufacturerListModel> >(manufacturerRepository.GetAll()));
 }
Exemplo n.º 15
0
 // GET: Manufacturer
 public ActionResult Index()
 {
     return(View(_manufacturers.GetAll()));
 }