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)); } }
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)); } }
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)); } }
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)); } }