예제 #1
0
        static void Main(string[] args)
        {
            ICarManager carManager = new ICarManager(new InMemoryCarDal());

            foreach (var car in carManager.GetAll())
            {
                Console.WriteLine(car.Description);
            }
        }
예제 #2
0
        public ActionResult List()
        {
            var model = new CarListViewModel
            {
                Cars = (List <Car>)_carManager.GetAll()
            };

            return(View(model));
        }
예제 #3
0
        public IActionResult GetAll()
        {
            var result = _carManager.GetAll();

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
예제 #4
0
        public IActionResult GetAll()
        {
            //Dependecy chain bağlımlılık zinciri car manager efcardal'a bağımlı
            //CarManager carManager = new CarManager(new EfCarDal());
            var result = _carManager.GetAll(1234);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
        public async Task <IActionResult> GetAsync()
        {
            var cars = await _car.GetAll();

            if (cars.Count != 0)
            {
                return(Ok(cars));
            }
            else
            {
                return(NotFound(new ErrorMessageVM()
                {
                    Message = "No Car Found in the Database!"
                }));
            }
        }
 public async Task <IActionResult> GetAll() => Ok(await _carManager.GetAll());