public static List<StickerPresentation> GetStickerList() { Hashtable htuser = new Hashtable(); using (MembershipStorage usercontext = new MembershipStorage()) { var usersList = (from user in usercontext.aspnet_Users where user.UserName.ToLower() != "admin" select user).ToList(); foreach (var item in usersList) { htuser.Add(item.UserId, item.UserName); } } List<StickerPresentation> stickerList = new List<StickerPresentation>(); using (StickersStorage context = new StickersStorage()) { var stickersCollection = (from stikers in context.Stickers.Include("Album") where stikers.UserId != SystemSettings.CurrentUserId select new { number = stikers.Number, isNeed = stikers.NeedOrFree == 1 ? true : false, isFree = stikers.NeedOrFree == 2 ? true : false, userId = stikers.UserId }).ToList(); foreach (var item in stickersCollection) { StickerPresentation sticker = new StickerPresentation(); sticker.Number = item.number; sticker.isNeed = item.isNeed; sticker.isFree = item.isFree; sticker.UserId = item.userId; sticker.UserName = (string)htuser[item.userId]; stickerList.Add(sticker); } } stickerList.Sort(new CollectStickers.Helpers.Helpers.SortStickersByUser()); return stickerList; }
public ActionResult Users() { List<UserPresentation> users = null; using (MembershipStorage context = new MembershipStorage()) { users = context.GetAllUsers(); } return View(users); }