public ActionResult Followers(int id, QueryParams query) { var followers = App.Get().CurrentWeb.Lists[id].Followers; var results = query.GetPageResult(followers).ToList(); var users = results.Select(p => new { id = p.UserName, dispName = p.DisplayName, name = new { firstName = p.FirstName, lastName = p.LastName }, email = p.Email, picture = p.Avatar, link = Url.Content("~/profiles/" + p.UserName) }).ToList(); string jsonStr = JsonConvert.SerializeObject(users); return(Content(jsonStr, "application/json", Encoding.UTF8)); }
public ActionResult Shares(string name, Guid id, QueryParams query) { if (id == Guid.Empty) { throw new ArgumentNullException("id"); } if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } var list = App.Get().CurrentWeb.Lists[name]; if (list == null) { throw new ContentListNotFoundException(); } var item = list.GetItem(id); if (item == null) { throw new ContentDataItemNotFoundException(); } var results = query.GetPageResult(item.Reshares()).ToList().Select(r => App.Get().Wrap(r).ToObject()).ToList(); var modal = new { Modal = results, Total = item.Reshares().Count() }; string jsonStr = JsonConvert.SerializeObject(modal, new JsonSerializerSettings() { DateFormatHandling = DateFormatHandling.MicrosoftDateFormat }); return(Content(jsonStr, "application/json", Encoding.UTF8)); }
public ActionResult List(QueryParams _params, string terms = "") { int total = 0; var query = context.Users.All().OrderBy(u => u.UserName); if (!string.IsNullOrEmpty(terms)) { query = context.Users.Filter(u => u.UserName.Contains(terms) || u.Email.Contains(terms)).OrderBy(u => u.UserName); } var values = new List <dynamic>(); total = query.Count(); var members = _params.GetPageResult(query, true).ToList(); foreach (var member in members) { var m = new { id = member.UserName, dispName = member.DefaultProfile.DisplayName, email = member.Email, created = member.CreationDate, approved = member.IsApproved, picture = string.IsNullOrEmpty(member.DefaultProfile.Avatar) ? "/content/images/no-avatar.gif" : member.DefaultProfile.Avatar, roles = member.Roles.Select(r => r.Name).ToArray(), validated = member.IsVaildMail }; values.Add(m); } return(Json(new ModelWrapper() { Model = values, Total = total }, JsonRequestBehavior.AllowGet)); }
public ActionResult List(QueryParams _params, string terms = "") { int total = 0; var query = context.Users.All().OrderBy(u => u.UserName); if (!string.IsNullOrEmpty(terms)) { query = context.Users.Filter(u => u.UserName.Contains(terms) || u.Email.Contains(terms)).OrderBy(u => u.UserName); } var values = new List<dynamic>(); total = query.Count(); var members = _params.GetPageResult(query, true).ToList(); foreach (var member in members) { var m = new { id = member.UserName, dispName = member.DefaultProfile.DisplayName, email = member.Email, created = member.CreationDate, approved = member.IsApproved, picture = string.IsNullOrEmpty(member.DefaultProfile.Avatar) ? "/content/images/no-avatar.gif" : member.DefaultProfile.Avatar, roles = member.Roles.Select(r => r.Name).ToArray(), validated = member.IsVaildMail }; values.Add(m); } return Json(new ModelWrapper() { Model = values, Total = total }, JsonRequestBehavior.AllowGet); }
public ActionResult Shares(string name, Guid id, QueryParams query) { if (id == Guid.Empty) throw new ArgumentNullException("id"); if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); var list = App.Get().CurrentWeb.Lists[name]; if (list == null) throw new ContentListNotFoundException(); var item = list.GetItem(id); if (item == null) throw new ContentDataItemNotFoundException(); var results = query.GetPageResult(item.Reshares()).ToList().Select(r => App.Get().Wrap(r).ToObject()).ToList(); var modal = new { Modal = results, Total = item.Reshares().Count() }; string jsonStr = JsonConvert.SerializeObject(modal, new JsonSerializerSettings() { DateFormatHandling = DateFormatHandling.MicrosoftDateFormat }); return Content(jsonStr, "application/json", Encoding.UTF8); }
public ActionResult Followers(int id, QueryParams query) { var followers = App.Get().CurrentWeb.Lists[id].Followers; var results = query.GetPageResult(followers).ToList(); var users = results.Select(p => new { id = p.UserName, dispName = p.DisplayName, name = new { firstName = p.FirstName, lastName = p.LastName }, email = p.Email, picture = p.Avatar, link = Url.Content("~/profiles/" + p.UserName) }).ToList(); string jsonStr = JsonConvert.SerializeObject(users); return Content(jsonStr, "application/json", Encoding.UTF8); }