public async Task <IActionResult> TemplateSave(TemplateViewModel model) { validationService.ValidatePaymentSchedule(model, ModelState); if (ModelState.IsValid) { Template template = _templateServiceService.FindTemplateById(model.TemplateId); _templateServiceService.AddTemplateNameDisc(template, model); if (model.IsSetSchedule) { IntervalType interval = await paymentScheduleService.FindIntervalTypeByIntervalCode(model.PaymentScheduleViewModel.IntervalCode.Value); paymentScheduleService.CreatePaymentSchedule(template, interval, model.PaymentScheduleViewModel.DateStart, model.PaymentScheduleViewModel.DateEnd); } return(RedirectToAction("Transfer", "Transfer")); } model.PaymentScheduleViewModel.IntervalTypes = selectListService.GetIntervalTypes(); return(View(model)); }