public CompanyModel CreateCompany(CompanyModel companyModel) { var companyEntity = _mapper.Map <CompanyEntity>(companyModel); var returnetCompany = _libraryRepository.CreateCompany(companyEntity); return(_mapper.Map <CompanyModel>(returnetCompany)); }
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"); }