public ActionResult Index(string searchString, int?page, int?pageSize) { var manufacturers = repository.GetAll(); if (!String.IsNullOrEmpty(searchString)) { // Only exact matches.. no multiple words // TODO manufacturers = manufacturers.AsQueryable().Where(p => p.Name.Contains(searchString) || p.Description.Contains(searchString) || p.ManufacturerId.ToString().Contains(searchString) // Add style here ); ViewBag.SearchString = searchString; } ViewBag.PageSize = pageSize; //return View(products.ToList()); return(Request.IsAjaxRequest() ? (ActionResult)PartialView("ManufacturerAdminPartial", manufacturers.ToList().OrderBy(p => p.ManufacturerId).ToPagedList(page ?? 1, pageSize ?? 2)) : View(manufacturers.ToList().OrderBy(p => p.ManufacturerId).ToPagedList(page ?? 1, pageSize ?? 2))); }
public IEnumerable <ManufacturerModel> GetAll() { var model = repository.GetAll(); var manufacturer = model.Select(x => new ManufacturerModel { Id = x.Id, Name = x.Name, CarsModel = x.Cars.Select(y => new CarModel { Id = y.Id, Name = y.Name, Details = y.Details.Select(z => new DetailModel { Id = z.Id, Name = z.Name, CarID = z.CarID, Price = z.Price }) }), DetailsModel = x.Details.Select(c => new DetailModel { Id = c.Id, Name = c.Name, CarID = c.CarID, Price = c.Price }) }); return(manufacturer); }
/// <summary> /// Gets all manufacturers /// </summary> /// <param name="manufacturerName">Manufacturer name</param> /// <param name="pageIndex">Page index</param> /// <param name="pageSize">Page size</param> /// <param name="showHidden">A value indicating whether to show hidden records</param> /// <returns>Manufacturers</returns> public virtual IPagedList <Manufacturer> GetAllManufacturers(string manufacturerName = "", int pageIndex = 0, int pageSize = int.MaxValue, bool showHidden = false) { var query = _manufacturerRepository.GetAll(); if (!showHidden) { query = query.Where(m => m.Published); } if (!String.IsNullOrWhiteSpace(manufacturerName)) { query = query.Where(m => m.Name.Contains(manufacturerName)); } query = query.Where(m => !m.Deleted); query = query.OrderBy(m => m.DisplayOrder); if (!showHidden && (!CatalogSettings.IgnoreAcl || !CatalogSettings.IgnoreStoreLimitations)) { //if (!CatalogSettings.IgnoreAcl) //{ // //ACL (access control list) // var allowedCustomerRolesIds = _workContext.CurrentCustomer.GetCustomerRoleIds(); // query = from m in query // join acl in _aclRepository.Table // on new { c1 = m.Id, c2 = "Manufacturer" } equals new { c1 = acl.EntityId, c2 = acl.EntityName } into m_acl // from acl in m_acl.DefaultIfEmpty() // where !m.SubjectToAcl || allowedCustomerRolesIds.Contains(acl.CustomerRoleId) // select m; //} if (!CatalogSettings.IgnoreStoreLimitations) { //Store mapping var currentStoreId = _storeContext.CurrentStore.Id; query = from m in query join sm in _storeMappingRepository.GetAll() on new { c1 = m.Id, c2 = "Manufacturer" } equals new { c1 = sm.EntityId, c2 = sm.EntityName } into m_sm from sm in m_sm.DefaultIfEmpty() where !m.LimitedToStores || currentStoreId == sm.StoreId select m; } //only distinct manufacturers (group by ID) query = from m in query group m by m.Id into mGroup orderby mGroup.Key select mGroup.FirstOrDefault(); query = query.OrderBy(m => m.DisplayOrder); } return(new PagedList <Manufacturer>(query, pageIndex, pageSize)); }
public IActionResult AddCar() { var manufacturersFromRepo = manufacturerRepo.GetAll(); var manufacturersDto = mapper.Map <IEnumerable <ManufacturerDto> >(manufacturersFromRepo); var viewModel = new AddCarViewModel { CarDto = new CarForCreationDto(), Manufacturers = manufacturersDto }; return(View(viewModel)); }
private void AddManufacturerBtn_Click(object sender, RoutedEventArgs e) { if (User.Role.userRole.Equals("Admin") || User.Role.userRole.Equals("Manager")) { NewManufacturerWindow newManWindow = new NewManufacturerWindow(); newManWindow.ManufacturerRepository = manufacturerRepository; newManWindow.ShowDialog(); ManufacturerDataGrid.ItemsSource = manufacturerRepository.GetAll(); } else { MessageBox.Show("У вас недостатньо прав!"); } }
public MainWindow() { InitializeComponent(); employeeRepository = new EmployeeRepositoryImpl(db); orderRepository = new OrderRepositoryImpl(db); clientRepository = new ClientRepositoryImpl(db); productRepository = new ProductRepositoryImpl(db); manufacturerRepository = new ManufacturerRepositoryImpl(db); roleRepository = new RoleRepositoryImpl(db); rankRepository = new RankRepositoryImpl(db); categorieRepository = new CategoyRepositoryImpl(db); paymentRepository = new PaymentRepositoryImpl(db); paymentModeRepositoy = new PaymentModeRepositoryImpl(db); userRepository = new UserRepositoryImpl(db); EmployeesDataGrid.ItemsSource = employeeRepository.GetAll(); OrdersDataGrid.ItemsSource = orderRepository.GetAll(); ClientsDataGrid.ItemsSource = clientRepository.GetAll(); ProductsDataGrid.ItemsSource = productRepository.GetAll(); ManufacturerDataGrid.ItemsSource = manufacturerRepository.GetAll(); PaymentsDataGrid.ItemsSource = paymentRepository.GetAll(); CategoriesDataGrid.ItemsSource = categorieRepository.GetAll(); UsersDataGrid.ItemsSource = userRepository.GetAll(); }
public IEnumerable <ManufacturerModel> GetAll() { var manufacturers = _repository.GetAll(); var manufacturerModels = manufacturers.Select(manuf => new ManufacturerModel() { Id = manuf.Id, Name = manuf.Name, Cars = manuf.Cars?.Select(car => new CarModel() { Id = car.Id, Name = car.Name, ManufacturerId = car.ManufacturerId, Details = car.Details?.Select(detail => new DetailModel() { Id = detail.Id, Name = detail.Name, Price = detail.Price, CarId = detail.CarId, DetailTypeId = detail.DetailTypeId, ManufacturerId = detail.ManufacturerId }) }) }); return(manufacturerModels); }
public IActionResult GetManufacturers() { try { ObjectResult results = new ObjectResult(_manufacturerRepository.GetAll()) { StatusCode = (int)HttpStatusCode.OK }; Request.HttpContext.Response.Headers.Add("X-Total-Count", _manufacturerRepository.GetAll().Count().ToString()); return(results); } catch (Exception ex) { return(new StatusCodeResult(500)); } }
public IActionResult Index() { var entities = _manufacturerRepository.GetAll(); var model = _mapper.Map <List <ManufacturerListItemVM> >(entities); return(View(model)); }
public void PrepareViewModel <T>(T model) where T : BaseProductViewModel { var categories = _categoryRepository.GetAll(); model.Categories = _mapper.Map <List <CategoryListItemVM> >(categories); var manufacturers = _manufacturerRepository.GetAll(); model.Manufacturers = _mapper.Map <List <ManufacturerListItemVM> >(manufacturers); }
public IEnumerable <ManufacturerDto> GetAllManufacturers() { var manufacturers = _manufacturerRepository.GetAll(); var operatorDtoList = new List <ManufacturerDto>(); manufacturers.ToList().ForEach(t => operatorDtoList.Add(Mapper.Map <Manufacturer, ManufacturerDto>(t))); return(operatorDtoList.OrderBy(t => t.Id)); }
public async void GetAllValid() { var listReturns = new List <Manufacturer> { EntitiesFactory.GetNewManufacturer() }; _manufacturedRepository.GetAll().Returns(listReturns); IEnumerable <Manufacturer> result = await _manufacturerService.GetAll(); result.Should().NotBeNull(); }
public IActionResult Index() { var banners = _bannerRepository.GetAll(); var manufacturers = _manufacturerRepository.GetAll(); var news = _newsItemRepository.GetAll().OrderByDescending(x => x.PublishedDate).Take(3); var model = new MainPageVM(); model.Banners = _mapper.Map <List <BannerListItemVM> >(banners); model.Manufacturers = _mapper.Map <List <ManufacturerListItemVM> >(manufacturers); model.News = _mapper.Map <List <NewsListItemVM> >(news); return(View(model)); }
public async Task <IEnumerable <Manufacturer> > GetPopularManufacturers() { var date = _dateService.GetDate(); var reviewPoints = _reviewService.GetUsersReviewPoints(); var manufacturers = await _manufacturerRepository.GetAll(); var random = new Random(); var numberFrom = random.Next(manufacturers.Count()); return(manufacturers.Skip(numberFrom).Take(manufacturers.Count() - numberFrom)); }
public IActionResult Index(int page = 1) { page = page < 1 ? 1 : page; var manufacturers = manufacturerRepo.GetAll(page: page, pageSize: PageSize); var manufacturersDto = mapper.Map <IEnumerable <ManufacturerDto> >(manufacturers); var viewModel = new ManufacturersListViewModel { Manufacturers = manufacturersDto, PageSize = PageSize, Page = page }; return(View(viewModel)); }
public ResponseMessage <List <Manufacturer> > GetAll() { ResponseMessage <List <Manufacturer> > response = new ResponseMessage <List <Manufacturer> >(); try { response.ResponseObject = _manufacturerRepository.GetAll(); response.IsSuccess = true; response.ErrorMessage = "Success"; } catch (Exception ex) { response.IsSuccess = false; response.ErrorMessage = ex.Message; } return(response); }
public IActionResult GetEngineTypePartsInManufacturer() { IEnumerable <EngineDto> engines = _engines.GetAll(); IEnumerable <EngineTypeDto> engineTypes = _engineTypes.GetAll(); var result = _manufacturers.GetAll() .Select(m => { var manufacturerModels = _models.Find(mm => mm.ManufacturerId == m.Id); return(new { ManufacturerId = m.Id, ManufacturerName = m.Name, EngineTypeParts = engineTypes .Join(engines, et => et.Id, e => e.EngineTypeId, (et, e) => new { typesId = et.Id, enginesId = e.Id }) .Join(manufacturerModels, at => at.enginesId, model => model.EngineId, (at, model) => new { model.Name, at.typesId }) .GroupBy(v => v.typesId) .Select(s => new { EngineTypeId = s.Key, Part = SafePartValue(s, manufacturerModels) }) .OrderBy(o => o.EngineTypeId) .ToDictionary(at => at.EngineTypeId, at => at.Part) }); }); var resultWithHeader = new { EngineTypes = engineTypes .Select(et => new { et.Id, et.Name }) .OrderBy(o => o.Id), Table = result }; return(Ok(resultWithHeader)); }
public IEnumerable <Manufacturer> GetManufacturers() { return(_manufacturerRepository.GetAll().Where(m => !m.Retired)); }
public List <ManufacturerDto> GetAll() { return(_mapper.Map <List <Manufacturer>, List <ManufacturerDto> >(_repository.GetAll())); }
public IEnumerable <Manufacturer> GetAll() { IEnumerable <Manufacturer> manufacturers = _manufacturerRepository.GetAll(); return(manufacturers.Where(manufacturer => manufacturer.IsActive == true)); }
/// <summary> /// Method whose purpose is to return all /// manufacturer records from the database. /// </summary> /// <returns> /// Returns all manufacturer objects as a IList /// of ManufacturerModel objects. /// </returns> public IList <ManufacturerModel> GetAll() { return(_manufacturerRepository.GetAll()); }
// GET: api/Manufacturers public IQueryable <Manufacturer> GetManufacturers() { return(_manufacturerRepository.GetAll()); }
public ICollection <Manufacturer> GetAll(Expression <Func <Manufacturer, bool> > predicateExpression) { return(_repository.GetAll(predicateExpression)); }
public IEnumerable <Manufacturer> GetAllManufacturers() { return(_manufacturerRepository.GetAll()); }
public ICollection <Manufacturer> GetAll() { return(_repository.GetAll()); }
public ICollection <ManufacturerDto> GetManufacturers() { return(_mapper.Map <ICollection <ManufacturerDto> >(_manufacturerRepository.GetAll())); }
public IList <Manufacturer> GetAllManufacturers() { return(_manufactureRepository.GetAll().ToList()); }
public async Task <RManufacturer[]> GetAll(ManufacturerGetRequest request) { return(await _manufacturerRepository.GetAll()); }