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); }
public VideogameModel CreateVideogame(int CompanyId, VideogameModel videogame) { validateCompany(CompanyId); return(_mapper.Map <VideogameModel>(_libraryRepository.CreateVideogame(_mapper.Map <VideoGameEntity>(videogame)))); }