Exemple #1
0
        public Favorite Get(int id)
        {
            var      favoriteGet = FavoriteFactoryDAL.GetCollectionDAL().Get(id);
            Favorite favorite    = new Favorite(favoriteGet.Id, favoriteGet.UserId, favoriteGet.CarId);

            return(favorite);
        }
Exemple #2
0
        public bool Create(Favorite favorite)
        {
            FavoriteDTO favoriteDTO = new FavoriteDTO()
            {
                Id     = 0,
                UserId = favorite.UserId,
                CarId  = favorite.CarId
            };

            return(FavoriteFactoryDAL.GetCollectionDAL().Create(favoriteDTO));
        }
Exemple #3
0
        public List <Car> GetAllFavorites(int userId)
        {
            List <Car> carList   = new List <Car>();
            var        favorites = FavoriteFactoryDAL.GetCollectionDAL().GetAllByUserId(userId);

            foreach (var favorite in favorites)
            {
                carList.Add(Get(favorite.CarId));
            }

            return(carList);
        }
Exemple #4
0
        public List <Favorite> GetAllByUserId(int userId)
        {
            List <Favorite> favoriteList = new List <Favorite>();
            var             favorites    = FavoriteFactoryDAL.GetCollectionDAL().GetAllByUserId(userId);

            foreach (var favorite in favorites)
            {
                favoriteList.Add(new Favorite(favorite.Id, favorite.UserId, favorite.CarId));
            }

            return(favoriteList);
        }
Exemple #5
0
 public bool CheckFavorite(int userId, int carId)
 {
     return(FavoriteFactoryDAL.GetCollectionDAL().CheckFavorite(userId, carId));
 }
Exemple #6
0
 public bool DeleteFromUser(int userId, int carId)
 {
     return(FavoriteFactoryDAL.GetCollectionDAL().DeleteFromUser(userId, carId));
 }
Exemple #7
0
 public bool Delete(int id)
 {
     return(FavoriteFactoryDAL.GetCollectionDAL().Delete(id));
 }