public async Task <IActionResult> AssignRoom(int sectionId, [FromBody] SaveRoomSectionAssignmentResource resource) { if (!ModelState.IsValid) { return(BadRequest()); } var section = await unitOfWork.Sections.Get(sectionId); if (section == null) { return(NotFound()); } var result = mapper.Map <SaveRoomSectionAssignmentResource, CourseOfferingRoomAssignment>(resource); //section.RoomAssignments.Add(result); await unitOfWork.CompleteAsync(); section = await unitOfWork.Sections.GetSectionWithBuilding(section.Id); var sectionResource = mapper.Map <Section, SectionResource>(section); return(Ok(sectionResource)); }
public async Task <IActionResult> AssignRoom(int sectionId, [FromBody] SaveRoomSectionAssignmentResource resource) { // some code here }