Пример #1
0
        public IActionResult PostStudent(StudentCommand.V1.Request request)
        {
            try
            {
                var student = MapToEntity(request);
                _dbContext.InsertEntityAsync(student);

                return(Ok(new { student.Id, StatusCode = 200 }));
            }
            catch (System.Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Пример #2
0
        public IActionResult PostClass(ClassCommand.V1.Request request)
        {
            try
            {
                var classEntity = MapToEntity(request);
                _dbContext.InsertEntityAsync(classEntity);

                return(Ok(new { classEntity.Id, StatusCode = 200 }));
            }
            catch (System.Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Пример #3
0
        public IActionResult PostRegistration(RegistrationCommand.V1.Requests request)
        {
            try
            {
                foreach (var req in request.Collection)
                {
                    var registration = MapToEntity(req);
                    _dbContext.InsertEntityAsync(registration);
                }

                return(Ok(0));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Пример #4
0
        public IActionResult PostTeacher(TeacherCommand.V1.Request teacherCommand)
        {
            try
            {
                if (teacherCommand == null)
                {
                    return(StatusCode(500, "Invalid Parameter"));
                }

                var teacher = MapToEntity(teacherCommand);
                _dbContext.InsertEntityAsync(teacher);

                return(Ok(new { teacher.Id, StatusCode = 200 }));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }