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