Esempio n. 1
0
        public IActionResult GetAllCategory()
        {
            var errors         = new List <string>();
            var categoryAccess = new CategoryAccess()
            {
                ExpenseConnection = _expenseConnection
            };

            IEnumerable <Category> categoryList = null;

            try
            {
                categoryList = categoryAccess.GetAll();

                _logger.LogInformation("User : {username} fetches all category", LoggedInUser);
            }
            catch (Exception Ex)
            {
                _logger.LogInformation("User : {username} gets expection while trying to fetch data for pageno {pageNo}", LoggedInUser);

                LogExecption(Ex, _expenseConnection);

                errors = new List <string>()
                {
                    _appConfiguration.Messages.InternalServerError
                };
            }

            return(Json(new
            {
                success = (errors.Count == 0),
                data = categoryList,
                error = errors
            }));
        }
Esempio n. 2
0
 public List <Categories> GetAll()
 {
     return(categoryAccess.GetAll());
 }