Esempio n. 1
0
        public void Execute(GenreDto request)
        {
            var genre = mapper.Map <Genre>(request);

            validator.ValidateAndThrow(request);

            context.Genres.Add(genre);
            context.SaveChanges();
        }
Esempio n. 2
0
        public void Execute(GenreDto request)
        {
            var genreFromDb = context.Genres.Find(request.Id);

            mapper.Map(request, genreFromDb);

            validator.ValidateAndThrow(request);

            context.SaveChanges();
        }
        public void Execute(GenreDto request)
        {
            validator.ValidateAndThrow(request);

            var genre = new Domain.Genre
            {
                Name = request.Name
            };

            context.Genres.Add(genre);
            context.SaveChanges();
        }