public async Task <Image> CreateImage(Image image) { var imageEntity = mapper.Map <ImageEntity>(image); EcomakRepository.CreateImage(imageEntity); if (await EcomakRepository.SaveChangesAsync()) { return(mapper.Map <Image>(imageEntity)); } throw new Exception("there where and error with the DB"); }