Example #1
0
 public IActionResult AddFriend([FromBody] AddFriendModel add)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     try
     {
         _friendsService.AddFriend(add);
         return(Ok());
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Example #2
0
        public async Task <IActionResult> Post([FromBody] FriendViewModel viewModel)
        {
            await _friendsService.AddFriend(viewModel);

            return(Ok(new { Message = "Success!", StatusCode = 200 }));
        }
 public void AddFriend(AddRemoveFriendModel model)
 {
     _friendsService.AddFriend(model.UserId, model.FriendId);
 }