Ejemplo n.º 1
0
        public void Add(Movie movie)
        {
            var existingMovie = _repository.GetAll().Where(x => x.UserID == movie.UserID && x.Title == movie.Title && x.Type == movie.Type).ToList();

            if (existingMovie.Count > 0)
            {
                throw new ApplicationException($"An existing movie of {movie.Title}, {movie.Type} already exists.");
            }
            _addEntityComponent.Execute(_repository, movie);
        }
Ejemplo n.º 2
0
        public void Add(Game game)
        {
            var existingGame = _repository.GetAll().Where(x => x.UserID == game.UserID && x.Title == game.Title).ToList();

            if (existingGame.Count > 0)
            {
                throw new ApplicationException($"An existing game of {game.Title} already exists.");
            }
            _addEntityComponent.Execute(_repository, game);
        }
Ejemplo n.º 3
0
        public void Add(Wish wish)
        {
            var existingWish = _repository.GetAll().Where(x => x.UserID == wish.UserID && x.Title == wish.Title && x.ItemType == wish.ItemType);

            if (existingWish.Any())
            {
                throw new ApplicationException($"An existing wish already exists for this user.");
            }

            _addEntityComponent.Execute(_repository, wish);
        }
Ejemplo n.º 4
0
        public void Add(FunkoPop pop)
        {
            var existingPops = _repository.GetAll().Any(x => x.UserID == pop.UserID && x.Title == pop.Title && x.Series == pop.Series && x.PopLine == pop.PopLine);

            if (existingPops)
            {
                throw new ApplicationException($"An existing Pop of {pop.Title}, {pop.Series}, {pop.PopLine} already exists.");
            }

            _addEntityComponent.Execute(_repository, pop);
        }
Ejemplo n.º 5
0
        public void Add(Book book)
        {
            var existingBook = _repository.GetAll().Where(x => x.UserID == book.UserID && x.Title == book.Title && x.Author == book.Author).ToList();

            if (existingBook.Count > 0)
            {
                throw new ApplicationException($"An existing book of {book.Title}, {book.Author} already exists.");
            }
            if (!string.IsNullOrWhiteSpace(book.ImageUrl) && !book.ImageUrl.Contains("https"))
            {
                book.ImageUrl = book.ImageUrl.Replace("http", "https");
            }
            _addEntityComponent.Execute(_repository, book);
        }
Ejemplo n.º 6
0
        public void Add(Album album)
        {
            var existingAlbum =
                _repository.GetAll()
                .Where(
                    x =>
                    x.UserID == album.UserID && x.Title == album.Title && x.Artist == album.Artist && x.MediaType == album.MediaType &&
                    x.DiscogsID == album.DiscogsID)
                .ToList();

            if (existingAlbum.Any())
            {
                throw new ApplicationException($"An existing album of {album.Artist}, {album.Title}, {album.MediaType} already exists.");
            }

            if (!string.IsNullOrWhiteSpace(album.ImageUrl) && !album.ImageUrl.Contains("https"))
            {
                album.ImageUrl = album.ImageUrl.Replace("http", "https");
            }
            _addEntityComponent.Execute(_repository, album);
        }