public void GetData() { YearList = new ObservableCollection <int>(); YearList.Add(2019); YearList.Add(2020); YearList.Add(2021); YearList.Add(2022); YearList.Add(2023); YearList.Add(2024); YearList.Add(2025); YearList.Add(2026); YearList.Add(2027); YearList.Add(2028); YearList.Add(2029); YearList.Add(2030); YearList.Add(2031); YearList.Add(2032); YearList.Add(2033); YearList.Add(2034); YearList.Add(2035); YearList.Add(2036); YearList.Add(2037); YearList.Add(2038); SelectedYear = DateTime.Now.Year; MonthList = new ObservableCollection <Month>(); MonthList.Add(new Month(1, "Январь")); MonthList.Add(new Month(2, "Февраль")); MonthList.Add(new Month(3, "Март")); MonthList.Add(new Month(4, "Апрель")); MonthList.Add(new Month(5, "Май")); MonthList.Add(new Month(6, "Июнь")); MonthList.Add(new Month(7, "Июль")); MonthList.Add(new Month(8, "Август")); MonthList.Add(new Month(9, "Сентябрь")); MonthList.Add(new Month(10, "Октябрь")); MonthList.Add(new Month(11, "Ноябрь")); MonthList.Add(new Month(12, "Декабрь")); SelectedMonthIndex = DateTime.Now.Month - 1; Children = ChildrenModel.SelectChildren(); Sections = SectionsModel.SelectSections(); GardenEvents = GardenEventsModel.SelectGardenEvents(SelectedSection, SelectedMonth.Number, SelectedYear); }
public IActionResult Post([FromBody] ChildrenModel newchildren) { try { _childrenService.Add(newchildren.ToDomainModel()); } catch (System.Exception ex) { ModelState.AddModelError("AddChildren", ex.Message); return(BadRequest(ModelState)); } return(CreatedAtAction("Get", new { Id = newChildren.Id }, newchildren)); }