Exemplo n.º 1
0
        public async Task <Guid> AddStudentAsync(Guid classId, UpsertStudentDto studentDto)
        {
            var student = await _executor.ExecuteAsync(new AddStudentCommand(classId, studentDto));

            if (!await _context.CommitAsync())
            {
                throw new Exception("Creating an student failed on save.");
            }
            if (student.StudentId != null)
            {
                await _hubContext.Clients.All.InvokeAsync("refresh");
            }
            return(student.StudentId);
        }
Exemplo n.º 2
0
        public async Task <Guid> AddClassAsync(UpsertClassDto classDto)
        {
            var @class = await _executor.ExecuteAsync(new AddClassCommand(classDto));

            if (!await _context.CommitAsync())
            {
                throw new Exception("Creating an class failed on save.");
            }
            if (@class.ClassId != null)
            {
                await _hubContext.Clients.All.InvokeAsync("refresh");
            }
            return(@class.ClassId);
        }