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(Jwt jwt) { _identityDatabaseContext.Add(jwt); _identityDatabaseContext.SaveChanges(); return(jwt.Id); }
public Guid Save(RolePermission rolePermission) { _identityDatabaseContext.Add(rolePermission); _identityDatabaseContext.SaveChanges(); return(rolePermission.Id); }
public Guid Save(Permission status) { _identityDatabaseContext.Add(status); _identityDatabaseContext.SaveChanges(); return(status.Id); }
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); }
public Guid Save(Role role) { _identityDatabaseContext.Add(role); _identityDatabaseContext.SaveChanges(); return(role.Id); }