// 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); }
// Constructor public BillingController(IAddUser addUser, IGetUser getUser, IUpdateUser updateUser, IHostingEnvironment env) { _addUser = addUser; _getUser = getUser; _updateUser = updateUser; _env = env; }
/// <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"); }
// private readonly IDeleteTable _deleteTable; public WebhookController(IAddUser putItem, IGetUser getItem, IUpdateUser updateItem) { // _createTable = createTable; _putItem = putItem; _getItem = getItem; _updateItem = updateItem; // _deleteTable = deleteTable; }
public UserAggregate Update(IUpdateUser command) { State.FirstName = command.FirstName; State.LastName = command.LastName; State.Email = command.Email; State.EmailConfirmed = command.IsEmailActivated; return(this); }
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; }
public ApiController(IDeleteUser deleteUser, IInsertUser insertUser, IGetUser getUser, IUpdateUser updateUser, IEncryptPassword encryptPassword) { _deleteUser = deleteUser; _insertUser = insertUser; _getUser = getUser; _updateUser = updateUser; _encryptPassword = encryptPassword; }
public UsersController(ICreateUser createUser, IGetUser getUser, IGetUsers getUsers, IUpdateUser updateUser, IDeleteUser deleteUser) { _createUser = createUser; _getUser = getUser; _getUsers = getUsers; _updateUser = updateUser; _deleteUser = deleteUser; }
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; }
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; }
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); }
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(); } }
public IActionResult Put(int id, [FromBody] UserDto dto, [FromServices] IUpdateUser command) { dto.Id = id; executor.ExecuteCommand(command, dto); return(StatusCode(StatusCodes.Status204NoContent)); }
// Constructor public UserpoolController(IUpdateUser updateUser) { //_getUser = getUser; _updateUser = updateUser; }
public UpdateUserTests() { appService = new UpdateUser(mockRepository, mockNotifier); }
public IActionResult Put(int id, [FromBody] UserDto dto, [FromServices] IUpdateUser command) { dto.Id = id; _executor.ExecuteCommand(command, dto); return(NoContent()); }
public IActionResult Put(int id, [FromForm] UserInfoUpdateDto dto, [FromServices] IUpdateUser command) { dto.UserId = id; _executor.ExecuteCommand(command, dto); return(Ok()); }
public UpdateUserController(IUserRepository repo, IMapper mapper, IUpdateUser updateUser) { _repo = repo; _mapper = mapper; _updateUser = updateUser; }