public void DeleteOrganizationUserRole(DeleteOrganizationUserRoleCommand command) { var entity = this.context.OrganizationUserRoles.FirstOrDefault(rp => rp.OrganizationId == command.OrganizationId && rp.OrganizationUserId == command.OrganizationUserId && rp.RoleId == command.RoleId); entity.DeletedAt = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); this.context.OrganizationUserRoles.Update(entity); this.context.SaveChanges(); }
public EmptyResult DeleteOrganizationUserRole(DeleteOrganizationUserRoleCommand command) { if (string.IsNullOrEmpty(command.RoleId)) { return(new Result <bool>(AuthorizationServiceErrors.InvalidDeleteEntityError(nameof(command.RoleId)))); } if (!command.OrganizationUserId.HasValue) { return(new Result <bool>(AuthorizationServiceErrors.InvalidDeleteEntityError(nameof(command.OrganizationUserId)))); } if (!command.OrganizationId.HasValue) { return(new Result <bool>(AuthorizationServiceErrors.InvalidDeleteEntityError(nameof(command.OrganizationId)))); } organizationUserRoleRepository.DeleteOrganizationUserRole(command); return(new Result <EmptyResult>()); }