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


C# UserService.CreateUser方法代码示例

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


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

示例1: GivenAStoredImage_WhenTheImageUrlIsConstructed_ThenTheImageIsReturned

        public void GivenAStoredImage_WhenTheImageUrlIsConstructed_ThenTheImageIsReturned()
        {
            var logger = new Mock<ILogger>();
            string connectionString = ConfigurationManager.ConnectionStrings["mblog"].ConnectionString;
            string key = "filename";
            IUserService userService = new UserService(new UserRepository(connectionString),
                                                       new UsernameBlacklistRepository(connectionString), 
                                                       logger.Object);
            User user = userService.CreateUser("name", "email", "password");

            IMediaRepository repository = new MediaRepository(connectionString);
            IMediaService mediaService = new MediaService(repository);
            var controller = new MediaController(mediaService, logger.Object);

            var stream = new MemoryStream(new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0});

            mediaService.WriteMedia(key, user.Id, "image/png", stream, 10);

            ActionResult result = controller.Show(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, key);
            Assert.That(result, Is.Not.Null);
        }
开发者ID:kevinrjones,项目名称:mblog,代码行数:21,代码来源:MediaControllerTest.cs

示例2: UserModule

        /// <summary>
        /// Sets up HTTP methods mappings.
        /// </summary>
        /// <param name="service">Service handling requests</param>
        public UserModule(UserService service)
            : base("/v2")
        {
            Post["/user"] = parameters =>
            {
                var body = this.Bind<User>();
                service.CreateUser(Context, body);
                return new Response { ContentType = "application/json"};
            };

            Post["/user/createWithArray"] = parameters =>
            {
                var body = this.Bind<List<User>>();
                service.CreateUsersWithArrayInput(Context, body);
                return new Response { ContentType = "application/json"};
            };

            Post["/user/createWithList"] = parameters =>
            {
                var body = this.Bind<List<User>>();
                service.CreateUsersWithListInput(Context, body);
                return new Response { ContentType = "application/json"};
            };

            Delete["/user/{username}"] = parameters =>
            {
                var username = Parameters.ValueOf<string>(parameters, Context.Request, "username", ParameterType.Path);
                Preconditions.IsNotNull(username, "Required parameter: 'username' is missing at 'DeleteUser'");

                service.DeleteUser(Context, username);
                return new Response { ContentType = "application/json"};
            };

            Get["/user/{username}"] = parameters =>
            {
                var username = Parameters.ValueOf<string>(parameters, Context.Request, "username", ParameterType.Path);
                Preconditions.IsNotNull(username, "Required parameter: 'username' is missing at 'GetUserByName'");

                return service.GetUserByName(Context, username);
            };

            Get["/user/login"] = parameters =>
            {
                var username = Parameters.ValueOf<string>(parameters, Context.Request, "username", ParameterType.Query);
                var password = Parameters.ValueOf<string>(parameters, Context.Request, "password", ParameterType.Query);
                return service.LoginUser(Context, username, password);
            };

            Get["/user/logout"] = parameters =>
            {

                service.LogoutUser(Context);
                return new Response { ContentType = "application/json"};
            };

            Put["/user/{username}"] = parameters =>
            {
                var username = Parameters.ValueOf<string>(parameters, Context.Request, "username", ParameterType.Path);
                var body = this.Bind<User>();
                Preconditions.IsNotNull(username, "Required parameter: 'username' is missing at 'UpdateUser'");

                service.UpdateUser(Context, username, body);
                return new Response { ContentType = "application/json"};
            };
        }
开发者ID:chameleon82,项目名称:swagger-codegen,代码行数:69,代码来源:UserModule.cs

示例3: CreateUser

 public void CreateUser(UserService userService, string userName, string email, string password, string firstName, string lastName, int age)
 {
     var user = userService.CreateUser(userName, email, password, firstName, lastName, age);
     PexAssert.IsNotNull(user);
 }
开发者ID:lynchjames,项目名称:ScotAlt.Net-Pex-QuickCheck,代码行数:5,代码来源:UserTests.cs

示例4: OnGUI

    void OnGUI()
    {
        if (Time.time % 2 < 1) {
            success = callBack.getResult ();
        }

        // For Setting Up ResponseBox.
        GUI.TextArea (new Rect (10, 5, 1300, 175), success);

        //=========================================================================
        if (GUI.Button (new Rect (50, 200, 200, 30), "Create User")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.CreateUser (cons.userName, password, cons.emailId, callBack);
        }

        //=========================================================================
        if (GUI.Button (new Rect (260, 200, 200, 30), "Get User")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.GetUser (cons.userName, callBack);
        }

        //=========================================================================
        if (GUI.Button (new Rect (470, 200, 200, 30), "Get All Users")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.GetAllUsers (callBack);
        }

        //=========================================================================
        if (GUI.Button (new Rect (680, 200, 200, 30), "Update Email")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.UpdateEmail (cons.userName, cons.emailId, callBack);
        }

        //=========================================================================
        if (GUI.Button (new Rect (890, 200, 200, 30), "Delete User")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.DeleteUser (cons.userName, callBack);
        }

        //=========================================================================
        if (GUI.Button (new Rect (50, 250, 200, 30), "Authenticate User")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.Authenticate (cons.userName, password, callBack);
        }

        //=========================================================================
        if (GUI.Button (new Rect (260, 250, 200, 30), "Change UserPassword")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.ChangeUserPassword (cons.userName, password, "newPassWord", callBack);
        }

        //===================================###################=========================================
        if (GUI.Button (new Rect (470, 250, 200, 30), "Lock User")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.LockUser (cons.userName, callBack);
        }

        //===================================###################=========================================
        if (GUI.Button (new Rect (680, 250, 200, 30), "Unlock User")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.UnlockUser (cons.userName, callBack);
        }

        //===================================###################=========================================
        if (GUI.Button (new Rect (890, 250, 200, 30), "Get LockedUsers")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.GetLockedUsers (callBack);
        }

        //===================================###################=========================================
        if (GUI.Button (new Rect (50, 300, 200, 30), "GetAllUsersByPaging")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.GetAllUsers (max, offSet, callBack);
        }

        //===================================###################=========================================
        if (GUI.Button (new Rect (260, 300, 200, 30), "GetAllUsersCount")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.GetAllUsersCount (callBack);
        }

        //===================================###################=========================================
        if (GUI.Button (new Rect (680, 300, 200, 30), "ResetUserPassword")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.ResetUserPassword (cons.userName, callBack);
        }

        //===================================###################=========================================
        if (GUI.Button (new Rect (890, 300, 200, 30), "Log out")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.Logout (cons.sessionId, callBack);
        }

        //===================================###################=========================================
        if (GUI.Button (new Rect (50, 350, 200, 30), "GetLockedUsersCount")) {
            userService = sp.BuildUserService (); // Initializing UserService.
            userService.GetLockedUsersCount (callBack);
        }

        //===================================###################=========================================
//.........这里部分代码省略.........
开发者ID:redstompstudio,项目名称:2015_Runner2D_Advergame,代码行数:101,代码来源:UserTest.cs


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