Exemple #1
0
        public async Task <Guid> Create(CustomerPostModel postModel)
        {
            if (postModel == null)
            {
                throw new InvalidArgumentException($"{typeof(CustomerPutModel).Name} was null!");
            }

            var entity = _mapper.Map <Customer>(postModel);
            await _writeOnly.SaveChangesAsync(entity);

            return(entity.Id);
        }
Exemple #2
0
        public async Task <Guid> Create(ProductPostModel postModel)
        {
            if (postModel == null)
            {
                throw new InvalidArgumentException($"{typeof(ProductPostModel).Name} was null!");
            }

            //await UploadImage(postModel.Image);

            var entity = _mapper.Map <Product>(postModel);

            await _fileService.UploadImage(entity.Image);

            await _writeOnly.SaveChangesAsync(entity);

            return(entity.Id);
        }