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


C# IUserService.GetUserById方法代码示例

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


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

示例1: UserModule

           public UserModule(IUserService userService):base("/users")
           {
               Get["/{id}", true] = async (ctx, cancel) =>
                   {
                       var request = this.Bind<GetUserByIdRequest>();

                       var user = await userService.GetUserById(new GetUserById()
                           {
                               Id = request.Id
                           });
                       return Response.AsJson(user);
                   };

               Post["/", true] = async (ctx, cancel) =>
                   {
                       var request = this.Bind<CreateUserRequest>();

                       var user = await userService.CreateUser(new CreateUser()
                           {
                               HourlyRate = request.HourlyRate,
                               Salary = request.Salary
                           });
                       
                       return Response.AsJson(user);
                   };
           }
开发者ID:EIrwin,项目名称:naylor-api,代码行数:26,代码来源:UserModule.cs

示例2: User_Saving

        /// <summary>
        /// User saving event.
        /// </summary>
        /// <remarks>
        /// User is already saved but the object itself is not updated yet.
        /// </remarks>
        void User_Saving(IUserService service, SaveEventArgs<IUser> e)
        {
            foreach (var savedEntity in e.SavedEntities)
            {
                if (savedEntity != null)
                {
                    if (!savedEntity.IsNewEntity())
                    {

                        // Update permissions for old users if the user type changes.
                        IUser savedUser = service.GetUserById(savedEntity.Id);
                        if (savedEntity.UserType.Alias != savedUser.UserType.Alias)
                        {
                            _userTypePermissionsService.CopyPermissionsForSingleUser(savedUser);
                        }

                    }
                    else
                    {

                        // Set permissions for new users.
                        _userTypePermissionsService.CopyPermissionsForSingleUser(savedEntity);

                    }
                }
            }
        }
开发者ID:AffinityID,项目名称:usergrouppermissions,代码行数:33,代码来源:UserSaved.cs

示例3: Page_Load

        private void Page_Load(object sender, System.EventArgs e)
        {
            _userService = IoC.Resolve<IUserService>();

            if (this.Page is GeneralPage && this._userId > 0)
            {
                GeneralPage page = (GeneralPage)this.Page;
                try
                {
                    User user = _userService.GetUserById(this._userId);

                    this.litTitle.Text = String.Format(GetTextFromFile("VIEWPROFILETITLE"), user.UserName);
                    BindUser(user);
                    if (! this.IsPostBack)
                    {
                        // Databind is required to bind the localized resources.
                        this.DataBind();
                    }
                }
                catch
                {
                    this.lblError.Text = String.Format(GetTextFromFile("USERNOTFOUND"), this._userId.ToString());
                    this.lblError.Visible = true;
                }
            }
        }
开发者ID:martijnboland,项目名称:Cuyahoga-Constructor,代码行数:26,代码来源:ViewProfile.ascx.cs


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