public async Task <JsonResult> Create([FromBody] CreateClassRoomDto dto) { var currentUser = await _userManager.GetUserAsync(User); var classRoom = new ClassRoom() { Name = dto.Name, TeacherId = currentUser.Id }; _dbContext.ClassRoom.Add(classRoom); _dbContext.SaveChanges(); return(Json(classRoom)); }
public async Task <JsonResult> Create([FromBody] CreateClassRoomDto dto) { var currentUser = await _userManager.GetUserAsync(User); var classRoom = new ClassRoom() { Name = dto.Name, TeacherId = currentUser.Id }; _dbContext.ClassRoom.Add(classRoom); _dbContext.SaveChanges(); AmazonSimpleNotificationServiceClient client = new AmazonSimpleNotificationServiceClient("AKIAJLAJIOHNR4Q2EQSQ", "+5t2ISSTpRYQnZomhd+C4S9LqQ8YiRqKjV1YRHLM", Amazon.RegionEndpoint.USWest2); CreateTopicRequest request = new CreateTopicRequest(classRoom.Id.ToString()); CreateTopicResponse ctr = await client.CreateTopicAsync(request); return(Json(classRoom)); }