public IActionResult SendRequest(int id) { var fromUserId = Convert.ToInt32(User.FindFirstValue(ClaimTypes.NameIdentifier)); _friendRequestService.SendRequest(id, fromUserId); return(Ok()); }
public async Task <IActionResult> SendRequest(string friendUsername) { string username = User.Identity.Name; if (username.ToLower() == friendUsername.ToLower()) { return(BadRequest(new { Message = "Invalid username supplied" })); } try { var ret = await service.SendRequest(username, friendUsername); if (ret.Success) { return(Ok(mapper.Map <UserResource>(ret.Resource))); } else { return(BadRequest(new { Message = ret.Message })); } } catch { return(StatusCode(500)); } }
public async Task SendRequest([FromBody] FriendRequestInputDto requestInputDto) { requestInputDto.RequestedFromId = UserId; await requestService.SendRequest(requestInputDto); }