public ActionResult InterestReport(string id) { if (!string.IsNullOrEmpty(id)) { SimpleAES aes = new SimpleAES(); string email = aes.DecryptFromBase64String(id); LockedModeUserClient lmu = new LockedModeUserClient(); LockedModeUser user = lmu.GetByPartitionAndRowKey(LockedModeUserClient.GetPartitionKeyForEmail(email), email); List <string> interests = new List <string>(); if (user != null) { Type userType = user.GetType(); foreach (var key in userType.GetProperties()) { if (key.CanRead) { object value = key.GetValue(user, null); if (value.ToString() == "1") { interests.Add(key.Name); } } } ViewBag.Interests = interests; return(View()); } } return(RedirectToAction("Index", "Home")); }
private string getInterestsJson(LockedModeUser user) { InterestsModel model = new InterestsModel(); List <string> result = new List <string>(); foreach (var property in model.GetType().GetProperties()) { if (user.GetType().GetProperty(property.Name).GetValue(user, null).ToString() == "1") { result.Add(property.Name); } } if (result.Count == 0) { return("[]"); } return("[\"" + string.Join <string>("\",\"", result) + "\"]"); }