コード例 #1
0
        public IHttpActionResult Get()
        {
            try
            {
                var tran = _factory.CreateDisplayExpensesTransaction();
                tran.Execute();
                var expneses = AutoMapper.Mapper.Map <IEnumerable <ViewModels.Expense> >(tran.Expenses);
                return(Ok(expneses));
            }
            catch (RepositoryException) { return(BadRequest()); }

            catch (Exception ex)
            {
                _logger.ErrorLog($"Web API failed to get expenses", ex);

                return(InternalServerError());
            }
        }