Exemplo n.º 1
0
        public JsonResult GetAllExpenses(int userId, string dbInstance)
        {
            try
            {
                if (userId == 0)
                {
                    throw new APIExpensesControllerException("Invalid input [UserId]");
                }
                if (String.IsNullOrEmpty(dbInstance))
                {
                    throw new APIExpensesControllerException("Invalid input [DBInstance]");
                }

                User usr = new User()
                {
                    UserId = userId, DBInstance = dbInstance
                };
                return(Json(ExpensesContext.LoadUserExpenses(usr)));
            }
            catch (APIExpensesControllerException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new Exception("Data Access error: " + ex.Message);
            }
        }