当前位置: 首页>>代码示例>>C#>>正文


C# IndexViewModel类代码示例

本文整理汇总了C#中IndexViewModel的典型用法代码示例。如果您正苦于以下问题:C# IndexViewModel类的具体用法?C# IndexViewModel怎么用?C# IndexViewModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IndexViewModel类属于命名空间,在下文中一共展示了IndexViewModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Index

        //
        // GET: /Manage/Index
        public async Task<ActionResult> Index(ManageMessageId? message)
        {
            ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess
                    ? Resources.Manage.ManageMessage_ChangePasswordSuccess
                    : message == ManageMessageId.SetPasswordSuccess
                        ? Resources.Manage.ManageMessage_SetPasswordSuccess
                        : message == ManageMessageId.SetTwoFactorSuccess
                            ? Resources.Manage.ManageMessage_SetTwoFactorSuccess
                            : message == ManageMessageId.Error
                                ? Resources.Manage.ManageMessage_Error
                                : message == ManageMessageId.AddPhoneSuccess
                                    ? Resources.Manage.ManageMessage_AddPhoneSuccess
                                    : message == ManageMessageId.RemovePhoneSuccess
                                        ? Resources.Manage.ManageMessage_RemovePhoneSuccess
                                        : "";

            var userId = User.Identity.GetUserId<int>();
            var model = new IndexViewModel
            {
                HasPassword = HasPassword(),
                PhoneNumber = await _userManager.GetPhoneNumberAsync(userId),
                TwoFactor = await _userManager.GetTwoFactorEnabledAsync(userId),
                Logins = await _userManager.GetLoginsAsync(userId),
                BrowserRemembered =
                    await _authenticationManager.TwoFactorBrowserRememberedAsync(User.Identity.GetUserId())
            };
            return View(model);
        }
开发者ID:egaia,项目名称:ASP.NET-Tournament.Manager,代码行数:31,代码来源:ManageController.cs

示例2: UpdateUser

        public ActionResult UpdateUser(IndexViewModel model)
        {
            var UserName = User.Identity.GetUserName();

            if (ModelState.IsValid)
            {
                var userManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));

                ApplicationUser user = context.Users.Where(u => u.UserName.Equals(UserName, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault();

                user.Address = model.Address;
                user.City = model.City;
                user.State = model.State;
                user.PostalCode = model.PostalCode;
                try
                {
                    context.SaveChanges();
                    return RedirectToAction("Index", new { Message = ManageMessageId.UpdateSuccess });
                }
                catch
                {
                    ViewBag.ResultMessage = "Update failed !";
                    return RedirectToAction("Index", new { Message = ManageMessageId.UpdateFailed });
                }
            }

            return RedirectToAction("Index", new { Message = ManageMessageId.UpdateFailed });

        }
开发者ID:dleivas,项目名称:SpecialBreakFast,代码行数:29,代码来源:ManageController.cs

示例3: Index

        public ActionResult Index()
        {
            var topOrganizations = this.Cache.Get(
                "topOrganizations",
                () => this.organizations
                .GetTopOrganizations(GlobalConstants.TopOrganizationsCount)
                .To<OrganizationViewModel>()
                .ToList(),
                30 * 60);

            var usersCount = this.Cache.Get(
                "usersCount",
                () => this.users.GetAll().Count(),
                30 * 60);

            var organizationsCount = this.Cache.Get(
                "usersCount",
                () => this.organizations.GetAll().Count(),
                30 * 60);

            var model = new IndexViewModel()
            {
                Organizations = topOrganizations,
                UsersCount = usersCount,
                OrganizationsCount = organizationsCount
            };

            return this.View(model);
        }
开发者ID:ni4ka7a,项目名称:GoDrive,代码行数:29,代码来源:HomeController.cs

示例4: Index

        public ActionResult Index(int page = 1)
        {
            if (page < 1)
            {
                page = 1;
            }

            var userId = this.User.Identity.GetUserId();
            var universitiesList = this.universities
                .All()
                .Where(u => u.DirectorId == userId)
                .To<UniversityViewModel>()
                .OrderBy(u => u.Name);

            var universitiesCount = universitiesList.Count();
            var modelUniversities = universitiesList.Skip((page - 1) * PageSize).Take(PageSize).ToList();

            var model = new IndexViewModel()
            {
                Page = page,
                UniversitiesCount = universitiesCount,
                Universities = modelUniversities,
                PageSize = PageSize
            };

            return this.View(model);
        }
开发者ID:shunobaka,项目名称:Interapp,代码行数:27,代码来源:HomeController.cs

示例5: Index

        public ActionResult Index()
        {
            var newestEvents = this.Cache.Get(
                WebControllerConstants.NewestEventsCacheKey,
                () => this.events
                    .GetNewestEvents(WebControllerConstants.HomePageNewestEventsCount)
                    .To<EventIndexViewModel>()
                    .ToList(),
                30 * 60);

            var newestArticles = this.Cache.Get(
                WebControllerConstants.NewestArticlesCacheKey,
                () => this.articles
                    .GetNewestEvents(WebControllerConstants.HomePageNewestArticlesCount)
                    .To<ArticleIndexViewModel>()
                    .ToList(),
                30 * 60);

            var viewModel = new IndexViewModel
            {
                Events = newestEvents,
                Articles = newestArticles
            };

            return this.View(viewModel);
        }
开发者ID:baretata,项目名称:ASP.NET-MVC-Individual-Project,代码行数:26,代码来源:HomeController.cs

示例6: Index

        // GET: /Manage/Index
        public async Task<ActionResult> Index(ManageMessageId? message)
        {
            this.ViewBag.StatusMessage = message == ManageMessageId.ChangePasswordSuccess
                                             ? "Your password has been changed."
                                             : message == ManageMessageId.SetPasswordSuccess
                                                   ? "Your password has been set."
                                                   : message == ManageMessageId.SetTwoFactorSuccess
                                                         ? "Your two-factor authentication provider has been set."
                                                         : message == ManageMessageId.Error
                                                               ? "An error has occurred."
                                                               : message == ManageMessageId.AddPhoneSuccess
                                                                     ? "Your phone number was added."
                                                                     : message == ManageMessageId.RemovePhoneSuccess
                                                                           ? "Your phone number was removed."
                                                                           : message == ManageMessageId.AddCityError
                                                                                ? "There is no such city in the database"
                                                                                : string.Empty;

            this.SetCurrentUser();
            var model = new IndexViewModel
            {
                User = this.Mapper.Map<UserViewModel>(this.CurrentUser)
            };

            return this.View(model);
        }
开发者ID:EmilNik,项目名称:SimilarBeads,代码行数:27,代码来源:ManageController.cs

示例7: Index

        public async Task<ActionResult> Index(Guid id, IndexViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            var data = new KeyDatesOverrideData
            {
                AcknowledgedDate = model.AcknowledgedDate.AsDateTime(),
                CommencementDate = model.CommencementDate.AsDateTime(),
                CompleteDate = model.CompleteDate.AsDateTime(),
                ConsentedDate = model.ConsentedDate.AsDateTime(),
                ConsentValidFromDate = model.ConsentValidFromDate.AsDateTime(),
                ConsentValidToDate = model.ConsentValidToDate.AsDateTime(),
                NotificationId = id,
                NotificationReceivedDate = model.NotificationReceivedDate.AsDateTime(),
                ObjectedDate = model.ObjectedDate.AsDateTime(),
                WithdrawnDate = model.WithdrawnDate.AsDateTime(),
                TransmittedDate = model.TransmittedDate.AsDateTime()
            };

            await mediator.SendAsync(new SetExportKeyDatesOverride(data));

            return RedirectToAction("Index", "KeyDates");
        }
开发者ID:EnvironmentAgency,项目名称:prsd-iws,代码行数:26,代码来源:KeyDatesOverrideController.cs

示例8: Index

        //
        // GET: /Manage/Index
        public async Task<ActionResult> Index(ManageMessageId? message)
        {
            ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
                : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
                : message == ManageMessageId.Error ? "An error has occurred."
                : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
                : "";

            var userId = User.Identity.GetUserId();
            var user = db.Users.Find(userId);
            var model = new IndexViewModel
            {
                FirstName = user.FirstName,
                LastName = user.LastName,
                Email = user.Email,
                AdminRights = user.HasAdminRights,
                BudgetItems = user.Household.BudgetItems.Where(m => m.CreatorId == userId),
                HasPassword = HasPassword(),
                PhoneNumber = await UserManager.GetPhoneNumberAsync(userId),
                TwoFactor = await UserManager.GetTwoFactorEnabledAsync(userId),
                Logins = await UserManager.GetLoginsAsync(userId),
                BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId)
            };
            return View(model);
        }
开发者ID:abigailwest,项目名称:BudgetApp,代码行数:30,代码来源:ManageController.cs

示例9: Index

        public async Task<IActionResult> Index(ManageMessageId? message = null)
        {
            ViewData["StatusMessage"] =
                message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
                : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
                : message == ManageMessageId.Error ? "An error has occurred."
                : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
                : "";

            var user = await GetCurrentUserAsync();
            if (user == null)
            {
                return View("Error");
            }
            var model = new IndexViewModel
            {
                HasPassword = await _userManager.HasPasswordAsync(user),
                PhoneNumber = await _userManager.GetPhoneNumberAsync(user),
                TwoFactor = await _userManager.GetTwoFactorEnabledAsync(user),
                Logins = await _userManager.GetLoginsAsync(user),
                BrowserRemembered = await _signInManager.IsTwoFactorClientRememberedAsync(user)
            };
            return View(model);
        }
开发者ID:ZhangYuef,项目名称:Tutorial-master,代码行数:26,代码来源:ManageController.cs

示例10: Index

        //
        // GET: /Manage/Index
        public async Task<ActionResult> Index(ManageMessageId? message)
        {
            ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess
                    ? "Your password has been changed."
                    : message == ManageMessageId.SetPasswordSuccess
                        ? "Your password has been set."
                        : message == ManageMessageId.SetTwoFactorSuccess
                            ? "Your two-factor authentication provider has been set."
                            : message == ManageMessageId.Error
                                ? "An error has occurred."
                                : message == ManageMessageId.AddPhoneSuccess
                                    ? "Your phone number was added."
                                    : message == ManageMessageId.RemovePhoneSuccess
                                        ? "Your phone number was removed."
                                        : "";

            var userId = User.Identity.GetUserId();
            var model = new IndexViewModel
            {
                HasPassword = HasPassword(),
                PhoneNumber = await UserManager.GetPhoneNumberAsync(userId),
                TwoFactor = await UserManager.GetTwoFactorEnabledAsync(userId),
                Logins = await UserManager.GetLoginsAsync(userId),
                BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId)
            };
            return View(model);
        }
开发者ID:RavindarYenugu,项目名称:Aegon,代码行数:30,代码来源:ManageController.cs

示例11: Index

        public ActionResult Index()
        {
            if (this.User.Identity.IsAuthenticated)
            {
                this.ViewData.Add("Username", this.User.Identity);
            }

            var ingredients = this.ingredients.GetRandomIngredients(3)
                                              .To<IngredientViewModel>()
                                              .ToList();

            var recipes = this.recipes.GetMostLikedRecipes(3)
                                       .To<RecipeViewModel>()
                                       .ToList();

            var articles = this.articles.GetNewestArticles(3)
                                        .To<ArticleViewModel>()
                                        .ToList();

            // var articles = this.Cache.Get("articles",
            //                               () => this.articles.GetNewestArticles(3)
            //                                                  .To<ArticleViewModel>()
            //                                                  .ToList(),
            //                               15 * 60);
            var viewModel = new IndexViewModel
            {
                Ingredients = ingredients,
                Recipes = recipes,
                Articles = articles
            };

            return this.View(viewModel);
        }
开发者ID:marianamn,项目名称:TasteIt,代码行数:33,代码来源:HomeController.cs

示例12: Index

        public ActionResult Index(string notebook)
        {
            var viewModel = new IndexViewModel();

            var noteStore = Evernote.GetNoteStore(User.Identity.Name);

            foreach (var n in noteStore.listNotebooks(User.Identity.Name))
            {
                var notesCount = noteStore.findNoteCounts(User.Identity.Name, new NoteFilter { NotebookGuid = n.Guid }, false).NotebookCounts.First().Value;
                var notebookViewModel = new IndexViewModel.Notebook
                {
                    Id = n.Guid,
                    Name = n.Name,
                    NotesCount = notesCount
                };

                if (n.Guid == notebook)
                    foreach (var note in noteStore.findNotes(User.Identity.Name, new NoteFilter { NotebookGuid = n.Guid }, 0, 1000).Notes)
                        notebookViewModel.Notes.Add(new IndexViewModel.Note
                        {
                            Id = note.Guid,
                            Name = note.Title,
                            UpdateDate = new DateTime(1970, 1, 1).AddMilliseconds(note.Updated)
                        });

                viewModel.Notebooks.Add(notebookViewModel);
            }

            return View(viewModel);
        }
开发者ID:nordineb,项目名称:EverMark,代码行数:30,代码来源:NotesController.cs

示例13: Index

        public virtual ActionResult Index()
        {
            SetNavigationHierarchy(GetLieDetectorOrThiefNavigationItems());

            var likelyThiefSuggestions = _documentSession.Query<LikelyThief>().OrderByDescending(x => x.AdditionDate).ToList();
            var lastComments =
                _documentSession.Query<LieDetectorOrThiefCommentsIndex.IndexResult, LieDetectorOrThiefCommentsIndex>().
                    OrderByDescending(x => x.DateTime).
                    Take(10).
                    AsProjection<LieDetectorOrThiefCommentsIndex.IndexResult>().
                    ToList();
            var lastCommentViewModels = lastComments.Select(
                x =>
                {
                    var actionResult = MVC.LieDetectorOrThief.LikelyThief.GetLikelyThief(new LikelyThief() { Id = x.Id });

                    return new GetCommentsFeedViewModel(actionResult, x.Id.GetNumericPart(), x.DateTime, x.Author, x.Text);
                }).
                ToList();
            var hasRightToAcceptLikelyThieves = SecurityUser.HasRight(RightType.AcceptLikelyThiefSuggestions, Initiative);

            var indexViewModel = new IndexViewModel(likelyThiefSuggestions, lastCommentViewModels, hasRightToAcceptLikelyThieves);

            return View(indexViewModel);
        }
开发者ID:alexidsa,项目名称:civildoit,代码行数:25,代码来源:LikelyThiefController.cs

示例14: Index

        public async Task<ActionResult> Index()
        {
            var model = new IndexViewModel();
            model.Areas = await GetAreas();

            return View(model);
        }
开发者ID:EnvironmentAgency,项目名称:prsd-iws,代码行数:7,代码来源:AdvancedSearchController.cs

示例15: Index

        //
        // GET: /Manage/Index
        public async Task<ActionResult> Index(ManageMessageId? message)
        {
            ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
                : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
                : message == ManageMessageId.Error ? "An error has occurred."
                : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
                : message == ManageMessageId.ChangeTelephoneSuccess ? "Číslo bylo úspěšně změněno."
                : message == ManageMessageId.ChangeMailSuccess ? "E-mail byl úspěšně změněn."
                : "";

            var userId = User.Identity.GetUserId();
            var user = await UserManager.FindByIdAsync(userId);
            var model = new IndexViewModel
            {
                //HasPassword = HasPassword(),
                //PhoneNumber = await UserManager.GetPhoneNumberAsync(userId),
                //TwoFactor = await UserManager.GetTwoFactorEnabledAsync(userId),
                //Logins = await UserManager.GetLoginsAsync(userId),
                //BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId)
                Telephone = user.Telephone,
                Email = user.Email
            };
            return View(model);
        }
开发者ID:sMteX,项目名称:RezervacniSystemRichard,代码行数:29,代码来源:ManageController.cs


注:本文中的IndexViewModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。