Esempio n. 1
0
 public void Setup()
 {
     MockJsonTreeDB.Clear();
     Command = new DeleteProfileCommand();
     Command.SetFactory(new MockJsonTreeDBFactory());
     SetupDB(DBPath);
 }
Esempio n. 2
0
        public void DeleteProfile(DeleteProfileCommand command)
        {
            var currentProfile = GetProfileEntityByOrganizationUserId(command.OrganizationUserId.Value, command.OrganizationId.Value);

            currentProfile.DeletedAt = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
            this.context.SaveChanges();
        }
Esempio n. 3
0
        public ActionResult <bool> Delete([FromBody] DeleteProfileDTO request)
        {
            var command = new DeleteProfileCommand(_mapper.Map <Data.Models.Profile>(request));
            var handler = _commandHandler.Build(command);

            return(Ok(handler.Execute()));
        }
        private void RaiseCurrentProfilePropertyChanged()
        {
            ViewModelBundle.UpdateCurrentProfile(CurrentProfile);

            RaisePropertyChanged(nameof(CurrentProfile));

            RaisePropertyChanged(nameof(Settings));
            DeleteProfileCommand.RaiseCanExecuteChanged();
            RenameProfileCommand.RaiseCanExecuteChanged();
        }
        public async Task <IActionResult> Delete([FromBody] DeleteProfileCommand deleteProfileCommand)
        {
            var response = await _mediator.Send(deleteProfileCommand, Request.HttpContext.RequestAborted);

            if (response.IsValid)
            {
                return(Ok(response));
            }
            return(BadRequest(response));
        }
Esempio n. 6
0
        public async Task <IActionResult> DeleteProfile([Range(1, int.MaxValue)] int profileId)
        {
            var command = new DeleteProfileCommand
            {
                ProfileId = profileId
            };

            await _mediator.Send(command);

            return(NoContent());
        }
 public void CurrentProfilePropertyChanged()
 {
     RaisePropertyChanged("CurrentProfile");
     RaisePropertyChanged("Settings");
     DeleteProfileCommand.RaiseCanExecuteChanged();
     RenameProfileCommand.RaiseCanExecuteChanged();
     RaisePropertyChanged("LowEncryptionEnabled");
     RaisePropertyChanged("MediumEncryptionEnabled");
     RaisePropertyChanged("HighEncryptionEnabled");
     RaisePropertyChanged("ExtendedPermissonsEnabled");
     RaisePropertyChanged("RestrictLowQualityPrintingEnabled");
     RaisePropertyChanged("AllowFillFormsEnabled");
     RaisePropertyChanged("AllowScreenReadersEnabled");
     RaisePropertyChanged("AllowEditingAssemblyEnabled");
 }
Esempio n. 8
0
        public async Task DeleteProfileCommandTestAsync(string identityUserId, DeleteProfileResponse result)
        {
            DeleteProfileCommand request = new DeleteProfileCommand
            {
                IdentityUserId = identityUserId,
            };
            DeleteProfileCommandHandler handler = new DeleteProfileCommandHandler(_deleteFixture.Context);
            var expectedResult = await handler.Handle(request, new CancellationToken());

            Assert.Equal(expectedResult.IsSuccessful, result.IsSuccessful);
            if (result.IsSuccessful)
            {
                Profile profile = _deleteFixture.Context.Profiles.Find(expectedResult.Id);
                Assert.Null(profile);
            }
            Assert.Equal(expectedResult.Message, result.Message);
        }
        public override Task <DeleteProfile.Types.Response> DeleteProfile(DeleteProfile.Types.Request request, ServerCallContext context)
        {
            var model = new DeleteProfileCommand
            {
                OrganizationUserId = request.OrganizationUserId.GetValueOrDefault(),
                ProfileId          = request.ProfileId.GetValueOrDefault()
            };
            var result = this.profileService.DeleteProfile(model);

            if (result.IsFailure)
            {
                HandleResultFailure(context, result);
                return(null);
            }

            return(Task.FromResult(new DeleteProfile.Types.Response {
            }));
        }
Esempio n. 10
0
        public EmptyResult DeleteProfile(DeleteProfileCommand command)
        {
            if (!command.OrganizationUserId.HasValue)
            {
                return(new Result <EmptyResult>(ProfileServiceErrors.InvalidOrganizationUserId()));
            }
            if (!command.OrganizationId.HasValue)
            {
                return(new Result <EmptyResult>(ProfileServiceErrors.InvalidOrganizationId()));
            }

            if (!profileRepository.ProfileExistsForOrganizationUser(command.OrganizationUserId.Value, command.OrganizationId.Value))
            {
                return(new EmptyResult(ProfileServiceErrors.InvalidProfileId()));
            }

            profileRepository.DeleteProfile(command);
            return(new EmptyResult());
        }
Esempio n. 11
0
        public async Task <IActionResult> Delete([FromRoute] Guid id)
        {
            try
            {
                if (id.Equals(Guid.Empty))
                {
                    return(base.BadRequest());
                }


                var command = new DeleteProfileCommand()
                {
                    Id = id
                };

                var result = await _mediator.Send(command);

                return(NoContent());
            }
            catch (NotFoundException)
            {
                return(base.NotFound());
            }
        }
        public IActionResult DeleteProfile(int userid)
        {
            var command = new DeleteProfileCommand(userid);

            return(ProcessCommand(command));
        }
Esempio n. 13
0
 public ICommandHandler <DeleteProfileCommand, bool> Build(DeleteProfileCommand command)
 {
     return(new DeleteProfileCommandHandler(_service, command));
 }