public override async Task ShowAvailableCarsGRPC(LocationRequest request, IServerStreamWriter <CarReply> responseStream, ServerCallContext context) { // facade kald til alle cars på en given location istedet Location l = new Location(request.Id, request.Address, request.City, request.Zipcode, request.Country); List <Car> cars = DbFacade.GetAvailableCars(l); List <CarReply> carReplies = new List <CarReply>(); foreach (var car in cars) { CarReply c = new CarReply() { AnimalsAllowed = car.AnimalsAllowed, Brand = car.Brand, CarId = car.Id, Color = car.Color, Doors = car.Doors, FuelType = car.FuelType, LicensePlate = car.LicensePlate, Model = car.Model, Price = car.Price, Type = car.Type }; carReplies.Add(c); } foreach (var car in carReplies) { // this sends our CarReply class to the client one at a time, until there are no more // essentially making this method of type void, as opposed to the previous method that returns a type. await responseStream.WriteAsync(car); } }
public override Task <CarReply> GetCar(CarRequest request, Grpc.Core.ServerCallContext context) { var r = new CarReply(); var f = r.Documents; return(base.GetCar(request, context)); }