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()); }
public void RemoveFavouriteGig(FavouriteGig favouriteGig) { _context.FavouriteGigs.Remove(favouriteGig); }
public void AddFavouriteGig(FavouriteGig favouriteGig) { _context.FavouriteGigs.Add(favouriteGig); }