public IEnumerable<Request> Find(Journey journey) { string findByJourney = @"select R from Request as R, Journey J where J.Traveller = :journeyUser and J.Traveller <> R.RequestedUser and J.Traveller.UserGroup = R.RequestedUser.UserGroup and R.Origin.Place = :origin and R.Destination.Place = :destination and R.Destination.Date.DateTime <= :arrivalDate"; IQuery query = Session.CreateQuery(findByJourney); query.SetParameter("journeyUser", journey.Traveller); query.SetString("origin", journey.Origin.Place); query.SetString("destination", journey.Destination.Place); query.SetDateTime("arrivalDate", journey.Destination.Date.DateTime); return query.List<Request>(); }
public ViewResult Create(JourneyModel journeyModel) { if (ModelState.IsValid) { Location origin = new Location(journeyModel.OriginPlace, new TravelDate(DateTime.Parse(journeyModel.OriginDate))); Location destination = new Location(journeyModel.DestinationPlace, new TravelDate(DateTime.Parse(journeyModel.DestinationDate))); IUserRepository userRepository = UserRepository.Instance; DomainModel.User user = userRepository.LoadUser(User.Identity.Name); DomainModel.Journey journey = new Journey(user, origin, destination); DomainModel.JourneyRepository.Instance.Save(journey); ViewData["MyOtherJourneyDetails"] = GetJourneyList(user); ViewData["Message"] = "Journey Created Successfully!"; } return View(journeyModel); }
public void Delete(Journey journey) { Session.Delete(journey); Session.Flush(); }
public void Save(Journey journey) { Session.Save(journey); if(JourneyCreated != null) JourneyCreated(new JourneyCreatedEventArgs{Journey = journey}); }
public Journey Load(int journeyId) { Journey journey = new Journey(); Session.Load(journey, journeyId); return journey; }
public Match(Journey journey, Request request) { this.Journey = journey; this.Request = request; }