public async Task <IEnumerable <PeopleModel> > GetAllPeoples() { return(await _peoplesRepository .Query() .ProjectTo <PeopleModel>(_mapper.ConfigurationProvider) .ToArrayAsync()); }
public async Task <StudyPlaceModel> DeleteStudyPlace(int id) { if (id == 1) { throw new HttpException(406, "Not Acceptable"); } await _peoplesRepository .Query() .Where(p => p.StudyPlaceId == id) .ForEachAsync(p => p.StudyPlaceId = 1); var result = _studyPlacesRepository.Delete(id); await _unitOfWork.CommitAsync(); return(_mapper.Map <StudyPlaceModel>(result)); }