public async Task <ActionResult <ClassRoomDto> > CreateClass([FromBody] ClassAddDto Class) { var enitite = _Mapper.Map <ClassRoom>(Class); _classRoomRepository.AddClassRoom(enitite); await _classRoomRepository.SaveAsync(); var ClassDto = _Mapper.Map <ClassRoomDto>(enitite); return(CreatedAtRoute(nameof(GetClassRoom), new { ClassRoomId = enitite.Id }, ClassDto)); }
public async Task <ActionResult <IEnumerable <ClassRoomDto> > > CreateClassCollections(IEnumerable <ClassAddDto> ClassCollections) { var ClassEnitites = _mapper.Map <IEnumerable <ClassRoom> >(ClassCollections); foreach (var Class in ClassEnitites) { _classRoom.AddClassRoom(Class); } await _classRoom.SaveAsync(); var ClassRoomDto = _mapper.Map <IEnumerable <ClassRoomDto> >(ClassEnitites); var idsString = string.Join(",", ClassRoomDto.Select(x => x.Id)); return(CreatedAtRoute(nameof(GetClassCollections), new { guids = idsString }, ClassRoomDto)); }