Exemple #1
0
        public ActionResult Index(SearchModel model)
        {
            if (model.IsValid)
            {
                IList <PointModel> points = new SearchService().Search(model);

                IList <SearchProfileModel> SearchProfiles = new List <SearchProfileModel>();
                if (Session.Count > 2)
                {
                    SearchProfiles = new SearchProfileService().GetSearchProfiles(new Guid(Session["USERNAME_KEY"].ToString()));
                }
                ViewBag.SearchProfile = new SelectList(SearchProfiles, "Id", "Name");
                ViewBag.Points        = points;
                return(View(model));
            }
            IList <SearchProfileModel> sp = new List <SearchProfileModel>();

            if (Session.Count > 2)
            {
                sp = new SearchProfileService().GetSearchProfiles(new Guid(Session["USERNAME_KEY"].ToString()));
            }
            ViewBag.SearchProfile = new SelectList(sp, "Id", "Name", model.SearchProfile.Id);


            return(RedirectToAction("Index"));
        }
Exemple #2
0
        public ActionResult Index()
        {
            IList <SearchProfileModel> SearchProfiles = new List <SearchProfileModel>();

            if (Session.Count > 2)
            {
                SearchProfiles = new SearchProfileService().GetSearchProfiles(new Guid(Session["USERNAME_KEY"].ToString()));
            }

            ViewBag.SearchProfile = new SelectList(SearchProfiles, "Id", "Name");

            SearchModel model = new SearchModel
            {
                Coordenate = Session["COORDENATES"].ToString(),
                Terms      = string.Empty
            };

            return(View(model));
        }
Exemple #3
0
        public Guid InsertUser(UserModel user)
        {
            Guid userId = new UserRepository().InsertUser(user);

            SearchProfileModel myDefaultSearchProfile = new SearchProfileModel
            {
                Id                  = Guid.NewGuid(),
                Name                = "Default",
                EventsSearchDays    = 10,
                IsActive            = true,
                PointsRangeDistance = 5,
                SearchCriteria      = string.Empty,
                Utilizador          = GetUser(userId),
                SearchProfileTopics = new TopicService().GetActiveTopics()
            };

            Guid id = new SearchProfileService().InsertSearchProfile(myDefaultSearchProfile);

            return(userId);
        }
Exemple #4
0
 public SearchProfileController(SearchProfileService searchProfileService)
 {
     _searchProfileService = searchProfileService;
 }