public void RemoveBlock(UserBlockVM model) { var blockRecord = _blockedUserRepository.Get(x => x.UserId == model.UserId && x.BlockedUserId == model.BlockedUserId); if (blockRecord != null) { _blockedUserRepository.Remove(blockRecord); } }
public void RemoveBlockedUser(ClaimsPrincipal user, int blockedUserId) { var thisUser = _userManager.GetUserAsync(user).Result; var blockedUser = _blockedUserRepository.Get(x => x.UserId == thisUser.Id && x.BlockedUserId == blockedUserId); if (blockedUser != null) { _blockedUserRepository.Remove(blockedUser); _blockedUserRepository.Save(); } }
// Engel Kaldırma public ServiceStatus RemoveBlockedUser(int blockedUserId) { var serviceStatus = new ServiceStatus(); var httpUser = _httpContextAccessor.HttpContext.User; var userId = int.Parse(httpUser.Claims.ToList().Where(x => x.Type == ClaimTypes.NameIdentifier).FirstOrDefault().Value); var blockedUser = _blockedUserRepository.Get(x => x.BlockedUserId == blockedUserId && x.UserId == userId); _blockedUserRepository.Remove(blockedUser); try { _blockedUserRepository.SaveChanges(); serviceStatus.Status = true; return(serviceStatus); } catch (Exception) { throw; } }