Ejemplo n.º 1
0
        public async Task <bool> CreateMonthlyBudgetBoard(MonthlyBudgetBoardCreate request)
        {
            var entity = new MonthlyBudgetBoard
            {
                MonthlyBudgetName = request.MonthlyBudgetName,
                BudgetBoardId     = request.BudgetBoardId
            };

            await _midasContext.MonthlyBudgetBoard.AddAsync(entity);

            return(await _midasContext.SaveChangesAsync() == 1);
        }
        public async Task <IActionResult> Create(MonthlyBudgetBoardCreate request)
        {
            try
            {
                await _monthlyBudgetService.CreateMonthlyBudgetBoard(request);

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception e)
            {
                ModelState.AddModelError("", e.InnerException.Message);
                return(View(request));
            }
        }