public async Task <int> CreateAudioBook(AudioBook model)
        {
            // todo: validate
            //add to context
            _context.AudioBooks.Add(model);
            await _context.SaveChangesAsync();

            return(model.Id);
        }
예제 #2
0
        public async Task <int> CreateAuthor(LookupItemModel model)
        {
            // todo: validate
            var author = _mapper.Map <Domain.Author>(model);

            _context.Authors.Add(author);
            _cache.Remove(CacheKeys.Authors);

            await _context.SaveChangesAsync();

            return(author.Id);
        }