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.")); } if (await _repo.GetUser(recipientId) == null) { return(NotFound()); } like = new Like { LikeeId = recipientId, LikerId = id }; _repo.Add <Like>(like); if (await _repo.SaveAll()) { return(Ok()); } return(BadRequest("Unable to like this profile")); }