public async Task <Supplier> Create(DtoSupplierPost dtoSupplierPost)
        {
            var supplier = new Supplier()
            {
                CompanyName  = dtoSupplierPost.CompanyName,
                ContactName  = dtoSupplierPost.ContactName,
                ContactTitle = dtoSupplierPost.ContactTitle,
                Address      = dtoSupplierPost.Address,
                City         = dtoSupplierPost.City,
                Region       = dtoSupplierPost.Region,
                PostalCode   = dtoSupplierPost.PostalCode,
                Country      = dtoSupplierPost.Country,
                Phone        = dtoSupplierPost.Phone,
                Fax          = dtoSupplierPost.Fax,
                HomePage     = dtoSupplierPost.HomePage,
            };

            unitOfWork.Add(supplier);

            unitOfWork.Commit();

            var newSupplier = await unitOfWork.Query <Supplier>().OrderBy(x => x.SupplierID).LastAsync();

            BackgroundJob.Enqueue(() => RefreshCache());

            return(newSupplier);
        }
Beispiel #2
0
        public async Task <DtoSupplierGet> PostSupplier([FromBody] DtoSupplierPost dtoSupplier)
        {
            var item = await queryProcessor.Create(dtoSupplier);

            var product = autoMapper.Map <DtoSupplierGet>(item);

            return(product);
        }