Пример #1
0
        // GET: Spending/Create
        public async Task <IActionResult> Create(int?id)
        {
            try
            {
                if (id == null)
                {
                    ViewBag.AnualBalances = await _repository.GetAnualBalances();

                    ViewBag.Categories = await _repository.GetSpendingTypes();

                    return(View("Create"));
                }
                else
                {
                    ViewBag.Balance = await _repository.GetBalance((int)id);

                    ViewBag.Categories = await _repository.GetSpendingTypes();

                    return(View("CreateFromBalance"));
                }
            }
            catch (Exception)
            {
                throw new Exception();
            }
        }