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


C# Models.GetType方法代码示例

本文整理汇总了C#中Models.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Models.GetType方法的具体用法?C# Models.GetType怎么用?C# Models.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Models的用法示例。


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

示例1: Edit

        public ActionResult Edit(Models.UserModel item)
        {
            var properties = new List<string>()
            {
                "Username",
                "FirstName",
                "LastName",
                "Email",
                "IsAdmin"
            };

            foreach (var property in properties)
            {
                var propInfo = item.GetType().GetProperty(property);
                if (propInfo == null)
                {
                    continue;
                }

                var val = propInfo.GetValue(item, null);
                if (val == null)
                {
                    continue;
                }

                SetProperty(new Commands.SetUserPropertyCommand
                {
                    UserID = item.Id,
                    Name = property,
                    Value = val.ToString()
                });
            }

            return RedirectToAction("Details", new { id=item.Id });
        }
开发者ID:phillipknauss,项目名称:CqrsSiteEngine,代码行数:35,代码来源:UserController.cs

示例2: Convert

 private void Convert(Models.Question q, QuestionAjax qa)
 {
     qa.url = Url.Action(q.GetType().Name, "Question", new { guid = q.Guid });
       qa.name = q.Description;
       qa.question = q.Title;
       qa.answer = q.Answer;
       if (q is MultipleChoiceQuestion)
       {
     qa.answers = getMultipleChoiceAnswers(((MultipleChoiceQuestion)q).Answers);
       }
       else if (q is OddOneOutQuestion)
       {
     qa.answers = getMultipleChoiceAnswers(((OddOneOutQuestion)q).Answers);
     qa.answer += " " + ((OddOneOutQuestion)q).Explanation;
       }
       else
       {
     qa.answers = "<span class=\"subtle\">open vraag</span>";
       }
 }
开发者ID:q42jaap,项目名称:VVV,代码行数:20,代码来源:QuestionController.cs

示例3: GetName

 public static string GetName(Models.OrderStatus orderStatus)
 {
     DisplayAttribute[] attributes = (DisplayAttribute[])orderStatus.GetType().GetField(orderStatus.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false);
     return attributes.Length > 0 ? attributes[0].Name : string.Empty;
 }
开发者ID:derderov,项目名称:Trucizny,代码行数:5,代码来源:Helpers.cs

示例4: NavigateToProviderLinkWizard

 /// <summary>
 /// Navigates the app to the wizard of linking a provider.
 /// </summary>
 public void NavigateToProviderLinkWizard(Models.Providers.ICartridgeProvider provider)
 {
     if (provider == null || provider.GetType() != typeof(Models.Providers.OneDriveCartridgeProvider))
     {
         throw new NotSupportedException();
     }
     
     NavigateCore(new Uri(String.Format("/Views/SettingsPage.xaml?{0}={1}&{2}={3}", SettingsViewModel.ProviderServiceNameKey, provider.ServiceName, SettingsViewModel.ProviderWizardKey, Boolean.TrueString), UriKind.Relative));
 }
开发者ID:WFoundation,项目名称:WF.Player.WinPhone,代码行数:12,代码来源:NavigationManager.cs


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