void IUserRoleService.Update(int userId, string roleName) { var role = roleRepository.GetMany(r => r.Name.Equals(roleName)).FirstOrDefault(); if (role == null) { return; } MyUserRole obj = new MyUserRole() { UserId = userId, RoleId = role.Id }; repository.Delete(ur => ur.UserId == userId); if (!roleName.Equals("Moderator")) { userCategoryRepository.Delete(uc => uc.UserId == userId); } repository.Add(obj); }
public void Delete(UserCategory userCategory) { _userCategoryRepository.Delete(userCategory); }