public async Task <LabCourse> Create(LabCourseCreate courseIn) { var course = LabCourse.FromCreate(courseIn); await _labCourses.InsertOneAsync(course); return(course); }
public async Task <ActionResult <LabCourse> > Create([FromHeader] string authToken, LabCourseCreate create) { if (!await _authenticationService.CheckAccess(authToken, "courseMgr")) { return(Unauthorized()); } LabCourse created = await _labCourseService.Create(create); await _logService.Create(new Log( null, AuthenticationHelpers.GetUserIdFromToken(authToken), DateTime.UtcNow, "Course created.", "labCourses", created.Id, JsonSerializer.Serialize(created) )); return(Ok(created)); }