public override Task <LocationArrayMessage> GetLocationsByName(SearchParamMessage request, ServerCallContext context) { LocationArrayMessage lam = new LocationArrayMessage(); List <Location> locationList = unitOfWork.LocationRepo.Get(l => l.Name.ToLower().Contains(request.Value.ToLower())).ToList(); List <LocationMessage> lmList = new List <LocationMessage>(); foreach (Location l in locationList) { lmList.Add(ConversionStuff.LocationToMessage(l)); } lam.Locations.AddRange(lmList); return(Task.FromResult(lam)); }
public override Task <LocationArrayMessage> GetAllLocations(Empty request, ServerCallContext context) { LocationArrayMessage lam = new LocationArrayMessage(); List <Location> locationList = unitOfWork.LocationRepo.Get(l => true).ToList(); List <LocationMessage> lmList = new List <LocationMessage>(); foreach (Location l in locationList) { lmList.Add(ConversionStuff.LocationToMessage(l)); } lam.Locations.AddRange(lmList); return(Task.FromResult(lam)); }
public async Task <LocationArrayMessage> GetLocationsByName(SearchParamMessage para) { if (client == null || token == "") { Debug.WriteLine("Null client or token"); return(null); } LocationArrayMessage reply = null; try { reply = await client.GetLocationsByNameAsync(para, headers); } catch (Exception e) { Debug.WriteLine(e.Message); } return(reply); }
public async Task <LocationArrayMessage> GetAllLocations() { if (client == null || token == "") { Debug.WriteLine("Null client or token"); return(null); } LocationArrayMessage reply = null; try { reply = await client.GetAllLocationsAsync(new Google.Protobuf.WellKnownTypes.Empty(), headers); } catch (Exception e) { Debug.WriteLine(e.Message); } return(reply); }