public async Task <ActionResult> AddSchedule(Guid groupId, string teamName, [FromBody] AddSchedule command) { command.GroupId = groupId; command.UserId = User.GetUserId(); command.TeamName = teamName; await _scheduleService.AddTeamSchedule(command); return(Ok()); }
private void addarch_bt_Click(object sender, RoutedEventArgs e) { ArchiveSavedJob archiveJob = new ArchiveSavedJob(); archiveJob.Id = Guid.NewGuid(); var addSchelude_dlg = new AddSchedule(archiveJob); if (addSchelude_dlg.ShowDialog() == true) { archiveJobs.Add(archiveJob); MessageBox.Show("Успешно изменено"); archiveJob.Status = ArchiveScheduler.Start(archiveJob); SaveData("archive-jobs.dat", archiveJobs); } db_archivejobs.Items.Refresh(); }
public async Task AddTeamSchedule(AddSchedule command) { await _administratorService.ValidateAtLeastModerator(command.UserId, command.GroupId); var group = await _groupRepository.GetWithTeamScheduleAndCourses(command.GroupId, command.TeamName); if (group == null) { throw new AppException($"Team with name {command.TeamName} doesn't exist.", AppErrorCode.DOESNT_EXIST); } var schedule = ScheduleFactory.Create(command.Schedule, group.Courses); var team = group.Teams.First(t => t.Name == command.TeamName); team.AddSchedule(schedule); await _groupRepository.SaveChangesAsync(); }
public Task <OperationResult <int> > Add(AddSchedule cmd) => _lazyDbConnection.TryExecuteDbMessageAsync(cmd);