예제 #1
0
        private void ValidateProfileCollections(ProfileModel profileModel, Profile model)
        {
            var llp = new LookupListProcessor <ProfileModel, Profile, CountriesToVisitModel, CountriesToVisit, string>(
                p => p.CountriesToVisit,
                p => p.CountriesToVisit,
                p => (string)p.Country,
                p => p.Country,
                (modelData, country) => _profileService.DeleteCountriesToVisit(modelData.Id, country),
                (modelData, country) => _profileService.AddCountriesToVisit(modelData.Id, country)
                );

            var llp2 = new LookupListProcessor <ProfileModel, Profile, LanguagesSpokenModel, LanguagesSpoken, string>(
                p => p.LanguagesSpoken,
                p => p.LanguagesSpoken,
                p => (string)p.Language,
                p => p.Language,
                (modelData, language) => _profileService.DeleteLanguagesSpoken(modelData.Id, language),
                (modelData, language) => _profileService.AddLanguagesSpoken(modelData.Id, language)
                );

            var llp3 = new LookupListProcessor <ProfileModel, Profile, SearchingForModel, SearchingFor, LookingFor>(
                p => p.Searches,
                p => p.Searches,
                p => (LookingFor)p.Search,
                p => p.Search,
                (modelData, search) => _profileService.DeleteSearches(modelData.Id, search),
                (modelData, search) => _profileService.AddSearches(modelData.Id, search)
                );

            llp.Process(Request, ModelState, profileModel, model);
            llp2.Process(Request, ModelState, profileModel, model);
            llp3.Process(Request, ModelState, profileModel, model);
        }
예제 #2
0
 public IList <VideoRoom> GetVideoRooms(Profile profile)
 {
     if (profile == null)
     {
         return(new List <VideoRoom>());
     }
     return(_videoRoomService.GetRooms(profile));
 }
예제 #3
0
 public State GetState(Profile profile)
 {
     if (profile == null) return null;
     try {
         var state = _stateRepositoryRaven.GetState(profile) ?? Mapper.Map<State>(profile);
         SetToxBoxInformation(state);
         _stateRepositoryRaven.Update(state);
         return state;
     } catch {
         return null;
     }
 }
예제 #4
0
 public PingResult Ping(Profile profile)
 {
     if(profile == null) return null;
     try {
         var state = GetState(profile);
         var lastVisitTime = state.LastOnline; //GetDbState(profile);  //_stateRepository.UpdateStatus(profile);
         var visits = _visitService.GetVisitorsSinceLastVisit(profile.Id, lastVisitTime);
         var conversations = _conversationService.GetConversationStatistics(profile.Id);
         return new PingResult {Visits = visits, Conversations = conversations, State = state};
     } catch {
         return null;
     }
 }
예제 #5
0
 public State GetState(Profile profile)
 {
     if (profile == null)
     {
         return(null);
     }
     try {
         var state = _stateRepositoryRaven.GetState(profile) ?? Mapper.Map <State>(profile);
         SetToxBoxInformation(state);
         _stateRepositoryRaven.Update(state);
         return(state);
     } catch {
         return(null);
     }
 }
예제 #6
0
 public PingResult Ping(Profile profile)
 {
     if (profile == null)
     {
         return(null);
     }
     try {
         var state         = GetState(profile);
         var lastVisitTime = state.LastOnline; //GetDbState(profile);  //_stateRepository.UpdateStatus(profile);
         var visits        = _visitService.GetVisitorsSinceLastVisit(profile.Id, lastVisitTime);
         var conversations = _conversationService.GetConversationStatistics(profile.Id);
         return(new PingResult {
             Visits = visits, Conversations = conversations, State = state
         });
     } catch {
         return(null);
     }
 }
예제 #7
0
 public IList<VideoRoom> GetVideoRooms(Profile profile)
 {
     if(profile == null) return new List<VideoRoom>();
     return _videoRoomService.GetRooms(profile);
 }
 public State GetState(Profile profile)
 {
     using (var session = _documentStore.OpenSession()) {
         return(session.Query <State>().FirstOrDefault(p => p.ProfileGuid == profile.Guid));
     }
 }
        private void ValidateProfileCollections(ProfileModel profileModel, Profile model)
        {

            var llp = new LookupListProcessor<ProfileModel, Profile, CountriesToVisitModel, CountriesToVisit, string>(
                p => p.CountriesToVisit,
                p => p.CountriesToVisit,
                p => (string)p.Country,
                p => p.Country,
                (modelData, country) => _profileService.DeleteCountriesToVisit(modelData.Id, country),
                (modelData, country) => _profileService.AddCountriesToVisit(modelData.Id, country)
                );

            var llp2 = new LookupListProcessor<ProfileModel, Profile, LanguagesSpokenModel, LanguagesSpoken, string>(
                p => p.LanguagesSpoken,
                p => p.LanguagesSpoken,
                p => (string)p.Language,
                p => p.Language,
                (modelData, language) => _profileService.DeleteLanguagesSpoken(modelData.Id, language),
                (modelData, language) => _profileService.AddLanguagesSpoken(modelData.Id, language)
                );

            var llp3 = new LookupListProcessor<ProfileModel, Profile, SearchingForModel, SearchingFor, LookingFor>(
                p => p.Searches,
                p => p.Searches,
                p => (LookingFor)p.Search,
                p => p.Search,
                (modelData, search) => _profileService.DeleteSearches(modelData.Id, search),
                (modelData, search) => _profileService.AddSearches(modelData.Id, search)
                );

            llp.Process(Request, ModelState, profileModel, model);
            llp2.Process(Request, ModelState, profileModel, model);
            llp3.Process(Request, ModelState, profileModel, model);
        }