コード例 #1
0
        public CompanyModel CreateCompany(CompanyModel companyModel)
        {
            var companyEntity   = _mapper.Map <CompanyEntity>(companyModel);
            var returnetCompany = _libraryRepository.CreateCompany(companyEntity);

            return(_mapper.Map <CompanyModel>(returnetCompany));
        }
コード例 #2
0
        public async Task <CompanyModel> CreateCompanyAsync(CompanyModel companyModel)
        {
            var companyEntity = _mapper.Map <CompanyEntity>(companyModel);

            _libraryRepository.CreateCompany(companyEntity);
            var result = await _libraryRepository.SaveChangesAsync();

            if (result)
            {
                return(_mapper.Map <CompanyModel>(companyEntity));
            }

            throw new Exception("Database Error");
        }