public async Task <IActionResult> CreateCourse([FromBody] CourseCreateModel courses) { var teacher = await _coursesRepository.CheckTeacherApproved(courses.TeacherId); if (!teacher) { return(BadRequest("Teacher not approved to create course")); } var courseName = await _coursesRepository.CourseName(courses); if (courseName) { return(BadRequest("Course name already exists. Please enter a unique course name")); } string prefix = ""; PutObjectRequest putobjectRequest = new PutObjectRequest(); putobjectRequest.BucketName = "onlinecourseswithvideos"; putobjectRequest.Key = (prefix.TrimEnd('/') + "/" + courses.CourseName.TrimEnd('/') + "/").TrimStart('/'); //putobjectRequest.InputStream = var response = await _amazonS3.PutObjectAsync(putobjectRequest); var res = response.HttpStatusCode; var result = await _coursesRepository.CreateCourse(courses); return(Ok(result)); }