コード例 #1
0
        public async Task <VideogameModel> CreateVideogameAsync(int CompanyId, VideogameModel videogame)
        {
            await validateCompany(CompanyId);

            var vidogameEntity = _mapper.Map <VideoGameEntity>(videogame);

            _libraryRepository.CreateVideogame(vidogameEntity);
            var saveResult = await _libraryRepository.SaveChangesAsync();

            if (!saveResult)
            {
                throw new Exception("save error");
            }

            var modelToReturn = _mapper.Map <VideogameModel>(vidogameEntity);

            modelToReturn.CompanyId = CompanyId;
            return(modelToReturn);
        }
コード例 #2
0
 public VideogameModel CreateVideogame(int CompanyId, VideogameModel videogame)
 {
     validateCompany(CompanyId);
     return(_mapper.Map <VideogameModel>(_libraryRepository.CreateVideogame(_mapper.Map <VideoGameEntity>(videogame))));
 }