public ActionResult Member(string username) { var cepgpDirectory = new DirectoryInfo(Server.MapPath("~/CEPGP/")); var repository = new FileTransactionRepository(cepgpDirectory); var transactions = repository.GetTransactionsForMember(username); var transactionDtos = new List <TransactionDto>(); foreach (var transaction in transactions) { transactionDtos.Add(new TransactionDto { Target = transaction.Target, IssuedBy = transaction.IssuedBy, EPBefore = transaction.EPBefore?.Value ?? 0, EPAfter = transaction.EPAfter?.Value ?? 0, GPBefore = transaction.GPBefore?.Value ?? 0, GPAfter = transaction.GPAfter?.Value ?? 0, Action = transaction.Action, Item = transaction.Item?.Id ?? 0 }); } return(Json(transactionDtos, JsonRequestBehavior.AllowGet)); }
// GET: Transactions public ActionResult Index() { var cepgpDirectory = new DirectoryInfo(Server.MapPath("~/CEPGP/")); var repository = new FileTransactionRepository(cepgpDirectory); var transactions = repository.GetTransactions(); return(View(transactions)); }
public ActionResult Member(string username) { var cepgpDirectory = new DirectoryInfo(Server.MapPath("~/CEPGP/")); var repository = new FileTransactionRepository(cepgpDirectory); var transactions = repository.GetTransactionsForMember(username); return(View(transactions)); }
static void Main(string[] args) { Console.WriteLine("Приложение для личного финансового учета"); Trace.Listeners.Add(new ConsoleTraceListener()); var currencyConverter = new ExchangeRatesApiConverter(new HttpClient(), new MemoryCache(new MemoryCacheOptions()), "a5cf9da55cb835d0a633a7825b3aa8b5"); var transactionParser = new TransactionParser(); // var transactionRepository = new InMemoryTransactionRepository(); var transactionRepository = new FileTransactionRepository("transactions.txt", transactionParser); var budgetApp = new BudjetApplication(transactionRepository, transactionParser, currencyConverter); //budgetApp.AddTransaction("Трата -10 EUR Продукты A-Store"); //budgetApp.AddTransaction("Трата -100 USD Бензин RP"); //budgetApp.AddTransaction("Трата -50 EUR Кафе Turandot"); //budgetApp.AddTransaction("Зачисление 2000 EUR Зарплата"); //budgetApp.AddTransaction("Перевод 50 EUR Услуги BeeLine"); budgetApp.OutputTransactions(); budgetApp.OutputBalanceInMainCurrencies(); var flagContinue = true; while (flagContinue) { Console.WriteLine("Введите 1 - для ввода новой транзакции, 2 - вывести транзакции, 0 - Выход"); var key = Console.ReadKey(); Console.WriteLine(); if (key.KeyChar == '0') { flagContinue = false; } else if (key.KeyChar == '1') { Console.WriteLine("Введите транзакцию: "); var input = Console.ReadLine(); budgetApp.AddTransaction(input); budgetApp.OutputBalanceInMainCurrencies(); } else if (key.KeyChar == '2') { Console.WriteLine("Список транзакций:"); Console.WriteLine("======================"); budgetApp.OutputTransactions(); budgetApp.OutputBalanceInMainCurrencies(); } } }