// GET:
        public ActionResult Index()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new PreferenceService(userId);
            var model   = service.GetPreferences();

            //var model = new PreferencesListItem[0];
            //return View(model);


            return(View(model));
        }
        public async Task <object> GetPreferences()
        {
            var preferences = await _preferenceService.GetPreferences();

            if (preferences == null)
            {
                return(JsonResults.Error(errorNum: 404, errorMessage: "Preferences not found"));
            }

            var models = new List <PreferenceViewModel>();

            foreach (var preference in preferences)
            {
                models.Add(GetPreferenceModel(preference));
            }

            return(JsonResults.Success(models));
        }