Esempio n. 1
0
        public bool Delete(Guid id)
        {
            Jwt jwt = this.GetById(id);

            _identityDatabaseContext.Remove(jwt);
            int result = _identityDatabaseContext.SaveChanges();

            return(Convert.ToBoolean(result));
        }
Esempio n. 2
0
        public bool Delete(Guid id)
        {
            RolePermission user = this.GetById(id);

            _identityDatabaseContext.Remove(user);
            int result = _identityDatabaseContext.SaveChanges();

            return(Convert.ToBoolean(result));
        }
        public int Delete(Guid userId, Guid id)
        {
            Permission user = this.GetById(userId, id);

            _identityDatabaseContext.Remove(user);
            int result = _identityDatabaseContext.SaveChanges();

            return(result);
        }
        public Guid Save(User user)
        {
            _identityDatabaseContext.Add(user);
            _identityDatabaseContext.SaveChanges();

            //inner join denemesi
            //var fff = from _user in _identityDatabaseContext.Set<User>()
            //          join role in _identityDatabaseContext.Set<Role>() on _user.Id equals role.UserId
            //          // where user.LocationId == 1
            //          select _user;

            return(user.Id);
        }
Esempio n. 5
0
        public Result <UserRole> UserAddRole(Guid ownerId, Guid userId, Guid roleId)
        {
            User user = _userRepository.GetById(ownerId, userId);

            if (user == null)
            {
                result.AddError("Üye bulunamadı.");
                return(result);
            }

            //Rol kullanıcıya daha önce atanmış ise bir işlem yapılmıyor
            bool resultIsAdded = IsAddedRole(user, roleId);

            if (resultIsAdded)
            {
                result.AddError("Bu rol daha önce eklenmiş.");
                return(result);
            }

            Role role = _roleRepository.GetById(ownerId, roleId);

            UserRole userRole = new UserRole();

            userRole.OwnerId  = ownerId;
            userRole.UserId   = userId;
            userRole.RoleId   = role.Id;
            userRole.StatusId = 1;

            _identityDatabaseContext.Add(userRole);
            int saveResult = _identityDatabaseContext.SaveChanges();

            result.Status = Convert.ToBoolean(saveResult);
            result.Data   = userRole;
            return(result);
        }
 public Guid Save(Role role)
 {
     _identityDatabaseContext.Add(role);
     _identityDatabaseContext.SaveChanges();
     return(role.Id);
 }