public Task ContinueToRegistration() { if (RegistrationCodeViewModel == null) { RegistrationCodeViewModel = new RegistrationCodeViewModel(this); } if (registrationCodePage == null) { registrationCodePage = new RegistrationCodePage(); } return(TaskHelper.RunOnUIThread(() => MainPage.Navigation.PushAsync(registrationCodePage, true))); }
public ActionResult Index(string userId, int page = 1) { Sidebar(); var userlist = db.Users.Where(s => s.UserType == Enums.UserType.Proxy).ToList(); ViewBag.UserList = userlist; var registrationCodes = db.RegistrationCodes.AsQueryable(); if (!string.IsNullOrWhiteSpace(userId)) { registrationCodes = registrationCodes.Where(s => s.OwnUser == userId); } var list = registrationCodes.OrderByDescending(s => s.CreateTime) .ThenByDescending(s => s.ID) .ToPagedList(page); var userids = list.Select(s => s.OwnUser).ToList(); userids.AddRange(list.Select(s => s.CreateUser).ToList()); userids.AddRange(list.Select(s => s.UseUser).ToList()); userids.Distinct(); var users = db.Users.Where(s => userids.Contains(s.Id)).ToList(); var model = list.Select(s => { var create = users.FirstOrDefault(u => u.Id == s.CreateUser); var own = users.FirstOrDefault(u => u.Id == s.OwnUser); var use = users.FirstOrDefault(u => u.Id == s.UseUser); var item = new RegistrationCodeViewModel() { Code = s.Code, Create = create, CreateTime = s.CreateTime, CreateUser = s.CreateUser, ID = s.ID, Own = own, OwnUser = s.OwnUser, Use = use, UseTime = s.UseTime, UseUser = s.UseUser, ActiveEndDateTime = s.ActiveEndDateTime, UseEndDateTime = s.UseEndDateTime }; return(item); }); ViewBag.Paged = list; return(View(model)); }