Exemplo n.º 1
0
        public async Task <filmEntity> updateFilm(Guid id, filmCreatOrUpdateRequest request)
        {
            var entity = await _dbContext.films.FirstOrDefaultAsync(g => g.id == id);

            entity.filmName = request.filmName;

            entity.genreId = request.genreId;

            entity.genreName = request.genreName;

            entity.producerId = request.producerId;

            entity.producerName = request.producerName;

            await _dbContext.SaveChangesAsync();

            return(entity);
        }
Exemplo n.º 2
0
        public async Task <filmEntity> addFilmEntity(filmCreatOrUpdateRequest request)
        {
            var entity = new filmEntity
            {
                filmName = request.filmName,

                genreId = request.genreId,

                genreName = request.genreName,

                producerId = request.producerId,

                producerName = request.producerName
            };

            _dbContext.films.Add(entity);

            await _dbContext.SaveChangesAsync();

            return(entity);
        }