private async Task UpdateLocationAsync(Location l) { try { await grpcClient.UpdateLocation(ConversionStuff.LocationToMessage(l)); } catch (Exception e) { Debug.WriteLine(e.Message); MessageBox.Show(e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
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 override Task <LocationMessage> GetLocationByID(IdMessage request, ServerCallContext context) { return(Task.FromResult(ConversionStuff.LocationToMessage(unitOfWork.LocationRepo.GetByID(request.Id)))); }