public async Task <IActionResult> Create(FeeInputModel input)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(input));
            }

            await this.feesService.AddAsync(input);

            return(this.RedirectToAction("AllPerSchool", "Children", new { area = string.Empty }));
        }
        public IActionResult Create()
        {
            var viewModel        = new FeeInputModel();
            var userName         = this.User.Identity.Name;
            var currentPrincipal = this.principalsRepository.AllAsNoTracking()
                                   .FirstOrDefault(x => x.User.UserName == userName);
            var schoolId = currentPrincipal.NurserySchoolId;

            viewModel.ChildrenItems = this.childrenService.GetAllAsKeyValuePairsPerSchool(schoolId);

            return(this.View(viewModel));
        }
예제 #3
0
        public async Task AddAsync(FeeInputModel input)
        {
            var fee = new Fee
            {
                Title       = input.Title,
                DateFrom    = input.DateFrom,
                DateTo      = input.DateTo,
                MoneyAmount = input.MoneyAmount,
                ChildId     = int.Parse(input.Child),
            };

            await this.feesRepository.AddAsync(fee);

            await this.feesRepository.SaveChangesAsync();
        }