コード例 #1
0
        // This kinda code is a trip down memory lane.
        // Filled with nightmares and horrors...
        public async Task UpdateUserAsync(UpdateReason updateReason, IUpdateUser userInfo)
        {
            User?user = await repository.FindByEmailAsync(userInfo.OriginalEmail);

            if (user is null)
            {
                return;
            }

            if (updateReason == UpdateReason.EmailChanged)
            {
                user.ChangeEmail(userInfo.UpdatedEmail);
                // Generate new security stamp
                // Notify marketing
            }
            else if (updateReason == UpdateReason.UsernameChanged)
            {
                user.ChangeUsername(userInfo.UpdatedUsername);
                // Update profile slug
                // Notify user's followers about the username change
            }
            else
            {
                throw new ArgumentException();
            }

            await repository.UpdateAsync(user);
        }
コード例 #2
0
ファイル: BillingController.cs プロジェクト: lencjj/CSC_CA2
 // Constructor
 public BillingController(IAddUser addUser, IGetUser getUser, IUpdateUser updateUser, IHostingEnvironment env)
 {
     _addUser    = addUser;
     _getUser    = getUser;
     _updateUser = updateUser;
     _env        = env;
 }
コード例 #3
0
 /// <summary>
 /// Constructor to initialise dependencies
 /// </summary>
 public UsersController(IGetUserById the_get_user_by_id_query
                         ,ICreateUser the_new_user_command
                         ,IUpdateUser the_update_user_command)
 {
     get_user_by_id_query = Guard.IsNotNull(the_get_user_by_id_query, "the_get_user_by_id_query");
     new_user_command = Guard.IsNotNull(the_new_user_command, "the_new_user_command");
     update_user_command = Guard.IsNotNull(the_update_user_command, "the_update_user_command");
 }
コード例 #4
0
        //  private readonly IDeleteTable _deleteTable;

        public WebhookController(IAddUser putItem, IGetUser getItem, IUpdateUser updateItem)
        {
            // _createTable = createTable;
            _putItem    = putItem;
            _getItem    = getItem;
            _updateItem = updateItem;
            // _deleteTable = deleteTable;
        }
コード例 #5
0
 public UserAggregate Update(IUpdateUser command)
 {
     State.FirstName      = command.FirstName;
     State.LastName       = command.LastName;
     State.Email          = command.Email;
     State.EmailConfirmed = command.IsEmailActivated;
     return(this);
 }
コード例 #6
0
        public UserController(INotifier notifier, IUpdateUser update, IDeleteUser delete, IGetUser get, IUriService uriService) : base(notifier)
        {
            this.update = update;
            this.delete = delete;
            this.get    = get;

            this.uriService = uriService;
        }
コード例 #7
0
 public ApiController(IDeleteUser deleteUser, IInsertUser insertUser, IGetUser getUser, IUpdateUser updateUser,
                      IEncryptPassword encryptPassword)
 {
     _deleteUser      = deleteUser;
     _insertUser      = insertUser;
     _getUser         = getUser;
     _updateUser      = updateUser;
     _encryptPassword = encryptPassword;
 }
コード例 #8
0
 public UsersController(ICreateUser createUser, IGetUser getUser, IGetUsers getUsers, IUpdateUser updateUser,
                        IDeleteUser deleteUser)
 {
     _createUser = createUser;
     _getUser    = getUser;
     _getUsers   = getUsers;
     _updateUser = updateUser;
     _deleteUser = deleteUser;
 }
コード例 #9
0
 public UsersController(ILoginService loginService, IPasswordService passwordService, IGetUsers getCommand, IGetOneUser getOneCommand, IAddUser addCommand,
                        IUpdateUser updateCommand, IDeleteUser deleteCommand)
 {
     this.loginService    = loginService;
     this.passwordService = passwordService;
     this.getCommand      = getCommand;
     this.getOneCommand   = getOneCommand;
     this.addCommand      = addCommand;
     this.updateCommand   = updateCommand;
     this.deleteCommand   = deleteCommand;
 }
コード例 #10
0
 public UsersController(MyComicListContext context, IGetUsers getCommand, IGetOneUser getOneCommand, IAddUser addCommand,
                        IUpdateUser updateCommand, IDeleteUser deleteCommand, IPasswordService passwordService)
 {
     Context              = context;
     this.getCommand      = getCommand;
     this.getOneCommand   = getOneCommand;
     this.addCommand      = addCommand;
     this.updateCommand   = updateCommand;
     this.deleteCommand   = deleteCommand;
     this.passwordService = passwordService;
 }
コード例 #11
0
        public TEntity Save(IUpdateUser request)
        {
            request = ControlUser(request);

            var entity = _userRepository.Users.FirstOrDefault(_ => _.Id == request.Id);

            entity.LastName  = request.LastName;
            entity.FirstName = request.FirstName;
            entity.IsActive  = request.IsActive;
            entity.BirthDate = request.BirthDate;

            return(entity);
        }
コード例 #12
0
 public static void SetWebServer(IHubCommands commands, IUpdateUser updateUser)
 {
     _commands   = commands;
     _updateUser = updateUser;
     WebServers.Add(new WebServer(KickResponse, "http://*:8080/Kick/"));
     WebServers.Add(new WebServer(PublicKeyModulusResponse, "http://*:8080/GetPublicKeyModulus/"));
     WebServers.Add(new WebServer(PublicKeyExponentResponse, "http://*:8080/GetPublicKeyExponent/"));
     WebServers.Add(new WebServer(SetUserResponse, "http://*:8080/SetUser/"));
     WebServers.Add(new WebServer(ResetUserResponse, "http://*:8080/ResetUser/"));
     foreach (var webServer in WebServers)
     {
         webServer.Run();
     }
 }
コード例 #13
0
 public IActionResult Put(int id, [FromBody] UserDto dto, [FromServices] IUpdateUser command)
 {
     dto.Id = id;
     executor.ExecuteCommand(command, dto);
     return(StatusCode(StatusCodes.Status204NoContent));
 }
コード例 #14
0
ファイル: UserpoolController.cs プロジェクト: lencjj/CSC_CA2
 // Constructor
 public UserpoolController(IUpdateUser updateUser)
 {
     //_getUser = getUser;
     _updateUser = updateUser;
 }
コード例 #15
0
 public UpdateUserTests()
 {
     appService = new UpdateUser(mockRepository, mockNotifier);
 }
コード例 #16
0
 public IActionResult Put(int id, [FromBody] UserDto dto, [FromServices] IUpdateUser command)
 {
     dto.Id = id;
     _executor.ExecuteCommand(command, dto);
     return(NoContent());
 }
コード例 #17
0
 public IActionResult Put(int id, [FromForm] UserInfoUpdateDto dto, [FromServices] IUpdateUser command)
 {
     dto.UserId = id;
     _executor.ExecuteCommand(command, dto);
     return(Ok());
 }
コード例 #18
0
 public UpdateUserController(IUserRepository repo, IMapper mapper, IUpdateUser updateUser)
 {
     _repo       = repo;
     _mapper     = mapper;
     _updateUser = updateUser;
 }