public async Task <IActionResult> DislikeUser(int id, int recipientId) { if (id != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var dislike = await _repo.GetDislike(id, recipientId); if (dislike != null) { return(BadRequest("You already disliked this user")); } var like = await _repo.GetLike(id, recipientId); if (like != null) { await _repo.DelLike(id, recipientId); //return BadRequest("Your like has been removed. You now dislike it."); } if (await _repo.GetUser(recipientId) == null) { return(NotFound()); } dislike = new Dislike { DislikerId = id, DislikeeId = recipientId }; _repo.Add <Dislike>(dislike); if (await _repo.SaveAll()) { return(Ok()); } return(BadRequest("Failed to Dislike user")); }