public ActionResult AddRegular(string Source, string PrepaidExpanse, string DatePrepaidExpanse, string Salary, string DateSalary) { if (!string.IsNullOrWhiteSpace(Source)) { if (float.TryParse(PrepaidExpanse, out var prepaidExpanse)) { if (DateTime.TryParse(DatePrepaidExpanse, out var datePrepaidExpanse)) { if (float.TryParse(Salary, out var salary)) { if (DateTime.TryParse(DateSalary, out var dateSalary)) { _incomeService.AddRegularIncome(_user, Source, datePrepaidExpanse, prepaidExpanse, dateSalary, salary); ViewBag.Title = "Доходы"; ViewBag.IncomesRegular = _incomeService.GetAll(_user).Where(x => x.GetType() == typeof(RegularIncome)); ViewBag.IncomesPeriod = _incomeService.GetAll(_user).Where(x => x.GetType() == typeof(PeriodicIncome)); return(View("Index")); } else { ViewBag.Error = "Введите дату окончаловки в формате ДД.ММ.ГГГГ"; } } else { ViewBag.Error = "Введите сумму окончаловки"; } } else { ViewBag.Error = "Введите дату аванса в формате ДД.ММ.ГГГГ"; } } else { ViewBag.Error = "Введите сумму аванса"; } } else { ViewBag.Error = "Введите название"; } ViewBag.Title = "Новый доход"; return(View("AddRegular")); }