コード例 #1
0
        public async Task <ActionResult <Asset> > GetAssets(int realtorId)
        {
            if (!(await _realtorRepository.RealtorExists(realtorId)))
            {
                return(NotFound());
            }
            var assetForRealtor = await _realtorRepository.GetAssetsForRealtor(realtorId);

            var assetForRealtorResults = _mapper.Map <IEnumerable <AssetDto> >(assetForRealtor);

            return(Ok(assetForRealtorResults));
        }
コード例 #2
0
        public async Task <ActionResult> DeleteRealtor(int id)
        {
            if (!await _realtorRepository.RealtorExists(id))
            {
                return(NotFound());
            }
            Realtors realtorEntityDelete = await _realtorRepository.GetRealtorById(id, true);

            if (realtorEntityDelete == null)
            {
                return(NotFound());
            }
            _realtorRepository.DeleteRealtor(realtorEntityDelete);
            if (!await _realtorRepository.Save())
            {
                return(StatusCode(500, "A problem happened while handling your request."));
            }
            return(NoContent());
        }