public void PushPedestrianRequestInfo(IPedestrianRequestInfo requestInfo) { CityLogic city = _cities.Items.FirstOrDefault(c => c.Pedestrians.Any(p => p.Id == requestInfo.PedestrianId)); if (city != null) { city.ModifyPedestrianRequestsCollection(col => col.Add(requestInfo)); } }
public IEnumerable <IPedestrianRequestInfo> EnumeratePedestrianRequests(Guid cityId) { IList <PedestrianRequestDA> requests = _dataProxy.Session.CreateCriteria <PedestrianRequestDA>() /*.Add(Restrictions.Where<PedestrianRequestDA>(p => p.Author.PersonInfo.City.Id == cityId))*/.List <PedestrianRequestDA>(); foreach (PedestrianRequestDA request in requests.Where(r => r.Author.PersonInfo.City.Id == cityId).ToArray()) { IPedestrianRequestInfo requestInfo = _server.CreatePedestrianRequestInfo(request.Id, request.Author.PersonInfo.Person.Id, request.Target.PersonInfo.Person.Id); requestInfo.Comment = request.Comment; yield return(requestInfo); } }
public void PushPedestrianRequest(PedestrianRequestDataContract request) { IPedestrianInfo pedestrian = _server.Cities.SelectMany(c => c.Pedestrians).FirstOrDefault(p => p.Id == request.PedestrianId); IDriverInfo driver = _server.Cities.SelectMany(c => c.Drivers).FirstOrDefault(d => d.Id == request.DriverId); if (pedestrian != null && driver != null) { IPedestrianRequestInfo requestInfo = _server.CreatePedestrianRequestInfo(pedestrian, driver); ConvertHelper.FillPedestrianRequestInfo(requestInfo, request); _server.PushPedestrianRequestInfo(requestInfo); } }
public void RemovePedestrianRequest(Guid requestId) { ICityLogic city = _server.Cities.FirstOrDefault(c => c.PedestrianRequests.Any(r => r.Id == requestId)); if (city != null) { IPedestrianRequestInfo request = city.PedestrianRequests.FirstOrDefault(r => r.Id == requestId); if (request != null) { city.ModifyPedestrianRequestsCollection(col => col.Remove(request)); } } }
public static void FillPedestrianRequestInfo(IPedestrianRequestInfo requestInfo, PedestrianRequestDataContract request) { requestInfo.Comment = request.Comment; }
public static PedestrianRequestDataContract CreatePedestrianRequestDataContract(IPedestrianRequestInfo request) { return(new PedestrianRequestDataContract { Id = request.Id, DriverId = request.DriverId, PedestrianId = request.PedestrianId, Comment = request.Comment }); }