예제 #1
0
        public IHttpActionResult Following(FollowingDto dto)
        {
            string userId = User.Identity.GetUserId();

            if (_context.Following.Any(f => f.FollowerId == userId && f.FolloweeId == dto.ArtistId))
            {
                return(BadRequest("Following already exists"));
            }

            var following = new Following
            {
                FollowerId = userId,
                FolloweeId = dto.ArtistId
            };

            _context.Following.Add(following);
            _context.SaveChanges();

            return(Ok());
        }
예제 #2
0
        public IHttpActionResult Follow(FollowingDto dto)
        {
            var userId = User.Identity.GetUserId();

            if (_context.Followings.Any(f => f.FolloweeId == userId && f.FolloweeId == dto.FolloweeId))
            {
                return(BadRequest("Already following"));
            }

            var following = new Following
            {
                FollowerId = userId,
                FolloweeId = dto.FolloweeId
            };

            _context.Followings.Add(following);
            _context.SaveChanges();

            return(Ok());
        }
예제 #3
0
        public IHttpActionResult Follow(FollowingDto dto)
        {
            var userId = User.Identity.GetUserId();

            if (_context.Followings.Any(f => f.FolloweeID == userId && f.FolloweeID == dto.FolloweeID))
            {
                return(BadRequest("Você já segue este artista!"));
            }

            var following = new Following
            {
                FollowerID = userId,
                FolloweeID = dto.FolloweeID
            };

            _context.Followings.Add(following);
            _context.SaveChanges();

            return(Ok());
        }
        public IHttpActionResult Follow(FollowingDto dto)

        {
            var userId = User.Identity.GetUserId();

            if (_context.Followings.Any(f => f.UserFollowedId == dto.UserFollowedId &&
                                        f.FollowerId == userId))
            {
                return(BadRequest("User has already followed this artist."));
            }

            var following = new Following()
            {
                FollowerId     = userId,
                UserFollowedId = dto.UserFollowedId
            };

            _context.Followings.Add(following);
            _context.SaveChanges();

            return(Ok());
        }
예제 #5
0
        public IHttpActionResult Attend(FollowingDto dto)
        {
            var userId = User.Identity.GetUserId();

            //var exists = _context.Attendances.Any(a => a.AttendeeId == userId && a.GigId == gigId);

            if (_context.Followings.Any(f => f.FolloweeId == userId && f.FolloweeId == dto.FolloweeId))
            {
                return(BadRequest("The attendance already exists"));
            }

            var following = new Following
            {
                FollowerId = userId,
                FolloweeId = dto.FolloweeId
            };

            _context.Followings.Add(following);
            _context.SaveChanges();

            return(Ok());
        }