public async Task <ICommandResult> Handle(EditAccountCommand command) { Account account = await _accountRepository.GetById(command.Id); if (account == null) { return(new CommandResult(false, Messages.Account_NOT_FOUND, null)); } account.Update(command.Name); AddNotifications(account.Notifications); if (!Valid) { return(new CommandResult( false, Messages.NOTIFICATIONS, Notifications)); } await _accountRepository.Update(account); return(new CommandResult( true, Messages.UPDATED_WITH_SUCCESS, new AccountCommandResult { Id = account.Id, Name = account.Name, CreatedDate = account.CreatedDate, CreatedByUserId = account.CreatedByUserId, })); }
public override void UnmountView() { base.UnmountView(); RecipientsTokenViewModel.UnmountView(); RecipientsCcTokenViewModel.UnmountView(); RecipientsBccTokenViewModel.UnmountView(); EditAccountCommand.UnmountView(); }
public override void MountView() { RecipientsTokenViewModel.MountView(); RecipientsCcTokenViewModel.MountView(); RecipientsBccTokenViewModel.MountView(); EditAccountCommand.MountView(); base.MountView(); }
public async Task <IActionResult> Put([FromBody] EditAccountCommand command) { try { _uow.OpenTransaction(); var result = await _handler.Handle(command); return(await Response(result, _handler.Notifications)); } catch (Exception ex) { return(await TryErrors(ex)); } }
public async Task <AccountCommandResult> Handle(EditAccountCommand command) { Account account = await _accountRepository.GetById(command.Id); if (account == null) { AddNotification("command", Messages.Account_NOT_FOUND); return(null); } account.Update(command.Name); AddNotifications(account.Notifications); await _accountRepository.Update(account); return(account.ToDto()); }
public async Task <ICommandResult> Handle(EditAccountCommand command) { Account account = await _accountRepository.GetById(command.Id); if (account == null) { return(new CommandResult(false, Messages.Account_NOT_FOUND, null)); } NameOrDescription name = new NameOrDescription(command.Name); account.Update(name, command.UpdatedByUserId); AddNotifications(name.Notifications); AddNotifications(account.Notifications); if (!Valid) { return(new CommandResult( false, Messages.NOTIFICATIONS, Notifications)); } await _accountRepository.Update(account); return(new CommandResult( true, Messages.UPDATED_WITH_SUCCESS, new AccountCommandResult { Id = account.Id, Name = account.Name.Name, CreatedDate = account.Audit.CreatedDateBy.CreatedDate, CreatedByUserId = account.Audit.CreatedDateBy.CreatedByUserId, UpdatedDate = account.Audit.UpdatedDateBy.UpdatedDate, UpdatedByUserId = account.Audit.UpdatedDateBy.UpdatedByUserId, CompanyId = account.Audit.CompanyAndBranchOffice.CompanyId, BranchOfficeId = account.Audit.CompanyAndBranchOffice.BranchOfficeId })); }
public override void UnmountView() { base.UnmountView(); EditAccountCommand.UnmountView(); }
public override void MountView() { EditAccountCommand.MountView(); base.MountView(); }
public async Task <IActionResult> Edit(EditAccountCommand command) { return(await _mediator.ExecuteCommandReturnActionResult(command)); }
public async Task <ICommandResult> Put([FromBody] EditAccountCommand command) { ICommandResult result = await _handler.Handle(command); return(result); }
public override void UnmountView() { base.UnmountView(); DirectoryTokenViewModel.UnmountView(); EditAccountCommand.UnmountView(); }
public override void MountView() { DirectoryTokenViewModel.MountView(); EditAccountCommand.MountView(); base.MountView(); }
public async Task <IActionResult> Edit([FromHybrid] EditAccountCommand command) { return(await Execute(command)); }