Esempio n. 1
0
        public static JsonResult Delete(IFinancesRepo _repo,
                                        Controller controller,
                                        Action <IFinancesRepo> deleteAction)
        {
            try
            {
                deleteAction(_repo);
                if (!_repo.SaveAll())
                {
                    throw new Exception(Constants.ExceptionConstants.FailedToSave);
                }
            }
            catch
            {
                return(controller.Json(false));
                //TODO Add logger to log ex
            }

            return(controller.Json(true));
        }
Esempio n. 2
0
        public static JsonResult Update(IFinancesRepo _repo,
                                        Controller controller,
                                        Action <IFinancesRepo> createAction)
        {
            try
            {
                if (controller.ModelState.IsValid)
                {
                    createAction(_repo);

                    if (!_repo.SaveAll())
                    {
                        throw new Exception(Constants.ExceptionConstants.FailedToSave);
                    }
                }
            }
            catch (Exception ex)
            {
                return(controller.Json(false));
                //TODO Add logger to log ex
            }

            return(controller.Json(true));
        }
Esempio n. 3
0
 public TransactionImportService(IHostingEnvironment env, IFinancesRepo repo)
 {
     _env  = env;
     _repo = repo;
 }
Esempio n. 4
0
 public DashboardController(IFinancesRepo repo)
 {
     _repo = repo;
 }
Esempio n. 5
0
 public SettingsController(IFinancesRepo repo)
 {
     _repo = repo;
 }
Esempio n. 6
0
 public TransactionsController(IFinancesRepo repo, IHostingEnvironment env, ITransactionImportService transactionImportService)
 {
     _repo        = repo;
     _environment = env;
     _transactionImportService = transactionImportService;
 }
Esempio n. 7
0
 public TagsController(IFinancesRepo repo)
 {
     _repo = repo;
 }