예제 #1
0
        // GET api/<controller>
        public async Task <IHttpActionResult> Get()
        {
            try
            {
                var result = await _flightsProcessor.GetAll();

                if (result != null)
                {
                    return(Ok(result));
                }
                else
                {
                    return(NotFound());
                }
            }
            catch (BusinessLayerException ex)
            {
                var errors = default(string);
                foreach (var item in ex.Errors)
                {
                    errors += item;
                }
                return(BadRequest(errors));
            }
        }
예제 #2
0
        // GET: Flights
        public async Task <ViewResult> Index()
        {
            var flights = await _flightsProcessor.GetAll();

            return(View(flights));
        }