/// <summary> /// Retrieves single address location by id. /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <Result <AddressDto> > GetLocationAsAddressAsync(int id) { try { var location = await this.Db.Locations .Include(x => x.Issues) .Include(x => x.Citizens) .SingleOrDefaultAsync(x => x.Id == id); if (location == null) { return(Result <AddressDto> .Failure("Location not found.")); } return(Result <AddressDto> .Success(LocationFactory.Address(location))); } catch (Exception exception) { Log.Logger.Error(exception, "Error in Get Location as Address method."); return(Result <AddressDto> .Failure("Error in Get Location as Address method.")); } }