public async Task <IActionResult> CreateRequest(FriendRequestViewModel model) { var friendRequestDTO = _mapper.Map <FriendRequestDTO>(model); await _service.Create(friendRequestDTO); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Add([FromBody] FriendRequestModel friendRequestModel) { if (!ModelState.IsValid) { return(BadRequest()); } var friendRequestDto = _mapper.Map <FriendRequestDto>(friendRequestModel); var statuscode = await _friendRequestService.Create(friendRequestDto); return(_friendRequestResponseCreator.ResponseForCreate(statuscode)); }
public ActionResult Create(int friendUserId) { try { var request = _friendRequestService.Create(User.Identity.GetUserId <int>(), friendUserId); return(RedirectToAction("GetUserFriends", "Home")); } catch (Exception ex) { return(Content(ex.Message)); } }