Beispiel #1
0
        public IActionResult RemoveFollow(RemoveFollowDTO model)
        {
            try
            {
                if (!_userService.Exists(model.FollowingId) && !_userService.Exists(model.FollowersId))
                {
                    return(NotFound("Kullanıcı yok"));
                }
                //önceden takip ediyormuyum?

                if (_followService.AmIFollowing(model.FollowersId, model.FollowingId))
                {
                    var removefollow = _followService.Get(i =>
                                                          i.FollowingId == model.FollowersId && i.FollowersId == model.FollowersId);
                    _followService.Delete(removefollow);
                    return(Ok("Başarılı"));
                }

                return(BadRequest("Bir sıkıntı oluştu!"));
            }
            catch (Exception e)
            {
                return(BadRequest(e));
            }
        }