Пример #1
0
        public IHttpActionResult Favourite(FavouriteGigDto favouriteGigDto)
        {
            var userId = User.Identity.GetUserId();

            if (unitOfWork.FavouriteGigRepository.GetFavouriteGigs(userId).Any(f => f.ActionerID == userId && f.GigID == favouriteGigDto.GigID))
            {
                return(BadRequest("You already have it in your favourites"));
            }

            var favorite = new FavouriteGig
            {
                ActionerID = userId,
                GigID      = favouriteGigDto.GigID
            };

            unitOfWork.FavouriteGigRepository.AddFavouriteGig(favorite);
            unitOfWork.Complete();

            return(Ok());
        }
Пример #2
0
 public void RemoveFavouriteGig(FavouriteGig favouriteGig)
 {
     _context.FavouriteGigs.Remove(favouriteGig);
 }
Пример #3
0
 public void AddFavouriteGig(FavouriteGig favouriteGig)
 {
     _context.FavouriteGigs.Add(favouriteGig);
 }