Esempio n. 1
0
        public IActionResult GetAll()
        {
            var cars = _carsService.GetAll();

            if (cars.Count == 0)
            {
                return(NoContent());
            }

            return(Ok(cars));
        }
Esempio n. 2
0
        //[Authorize(Roles ="Cars.List")]
        public IActionResult GetAll()
        {
            // Dependency chain-- IProductService ProductManager a ihtiyaç duyuyor.  O da EfProductDal a.
            //IProductService productService = new ProductManager(new EfProductDal());
            var result = _carService.GetAll();

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
        public ActionResult Index()
        {
            IEnumerable <SliderViewModel> cars =
                carsService.GetAll().
                Include(m => m.Make).OrderByDescending(x => x.CreatedOn).Take(5).ProjectTo <SliderViewModel>().ToList();
            var viewModel = new HomeViewModel();

            viewModel.Slides = cars;
            viewModel.Search = new SearchViewModel();
            var makes         = this.makesService.GetAll().ToList();
            var transmissions = this.transmissionsService.GetAll().ToList();

            viewModel.Search.Makes         = makes;
            viewModel.Search.Transmissions = transmissions.OrderBy(x => x.Name);
            return(View(viewModel));
        }
Esempio n. 4
0
        public async Task <IActionResult> Get()
        {
            var result = await _carsService.GetAll();

            var carResponses = new List <CarsResponse>();

            var sync = new object();

            Parallel.ForEach(result, c => {
                lock (sync) {
                    carResponses.Add(c.ToCarsResponse());
                };
            });

            return(Ok(new GetCarsResponse {
                Cars = carResponses
            }));
        }
Esempio n. 5
0
        public async Task <IActionResult> Index()
        {
            var model = await _service.GetAll();

            return(View(model));
        }
Esempio n. 6
0
 public IActionResult Index()
 {
     return(View(_carsService.GetAll()));
 }
Esempio n. 7
0
 private void LoadCars()
 {
     dgwCars.DataSource = _carsService.GetAll();
 }