public async Task <IActionResult> Create([Bind("SequentialNumber,Description")] EventTemplate eventTemplate)
        {
            if (ModelState.IsValid)
            {
                var eventTemplates = await _context.EventTemplates.ToListAsync();

                eventTemplates.ForEach(x => x.SequentialNumber += x.SequentialNumber >= eventTemplate.SequentialNumber ? +1 : 0);
                _context.UpdateRange(eventTemplates);
                _context.Add(eventTemplate);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ModelState.AddModelError("", "Описание мероприятия должно содержать от 5 до 150 символов");
            return(await Index(eventTemplate));
        }
        public async Task <IActionResult> Edit(List <Event> events, int id, bool students, bool teachers, bool advisers)
        {
            if (SchedulePlanExists(id))
            {
                var schedulePlan = _context.SchedulePlans.FirstOrDefault(x => x.Id == id);
                schedulePlan.LastChangedDate = DateTime.Now;
                _context.UpdateRange(events);
                _context.Update(schedulePlan);
                await _context.SaveChangesAsync();

                await MailingAsync(id, students, teachers, advisers);

                return(RedirectToAction(nameof(Edit), new { id }));
            }
            return(await Edit(id));
        }