public ActionResult Search()
 {
     SearchResultModel model = new SearchResultModel();
     model.SearchString = "";
     model.SearchType = SearchType.PERSON;
     return View(model);
 }
        public ActionResult Search(SearchResultModel model)
        {
            if (model.SearchType == SearchType.EVENT)
            {
                return RedirectToAction("All", "Event", new
                {
                    SeachString = model.SearchString,
                    DateSearch = false
                });
            }

            UserProfileModel upm = accountServices.GetUserProfileByUsername(model.SearchString);
            SearchResultModel srm = new SearchResultModel();

            if (model.SearchType == SearchType.DATE)
            {
                try
                {
                    DateTime b = DateTime.Parse(model.SearchString);
                    srm.EventResult = eventService.QueryEventsByDate(b, 1);
                }
                catch (FormatException e)
                {
                    srm.Message = "Invalid date format.";
                }
            }
            else if (model.SearchType == SearchType.PLACE)
            {
                srm.EventResult = eventService.QueryEventsByLocation(model.SearchString);
            }
            else if (model.SearchType == SearchType.PERSON)
            {
                srm.UserResult = accountServices.QueryUsers(new QueryUserModel
                {
                    FirstName = model.SearchString,
                    LastName = model.SearchString,
                    Username = model.SearchString
                });
            }
            /*
            srm.UserResult = new List<ProfileViewModel>();
            if (upm != null)
            {
                ProfileViewModel pm = new ProfileViewModel();
                pm.FirstName = upm.FirstName;
                pm.LastName = upm.LastName;
                pm.UserId = accountServices.GetUserByUsername(model.SearchString).UserId;
                pm.UserProfileId = upm.UserProfileId;
                pm.Username = getAccountService().GetUserByUserProfileId(upm.UserProfileId).Username;
                srm.UserResult.Add(pm);
            }*/
            //for now just searches for a user profile
            return View(srm);
        }