コード例 #1
0
        public async Task <IHttpActionResult> DeleteProducts(string id)
        {
            var result = Task.Factory.StartNew(() =>
            {
                IUnitOfWork uow = new UnitOfWorkImp(new IRepositoryConnection[] { ProductsRepository });
                var bo          = new BOProducts();
                bo.Repository   = ProductsRepository;
                bo.Init(id);

                uow.Delete(bo);

                string err;
                if (!uow.Commit(out err))
                {
                    var resp = new HttpResponseMessage(HttpStatusCode.BadRequest)
                    {
                        Content = new StringContent(err)
                    };
                    throw new HttpResponseException(resp);
                }
                return(true);
            });
            await result;

            if (!result.Result)
            {
                return(NotFound());
            }

            return(Ok(result.Result));
        }
コード例 #2
0
ファイル: ProductsVm.cs プロジェクト: isakatirci/NorthwindMVC
        public IBOProducts BOProducts(IProductsRepository repo)
        {
            BOProducts boProducts = (BOProducts)BOProducts();

            boProducts.Repository = repo;
            return(boProducts);
        }
コード例 #3
0
ファイル: ProductsVm.cs プロジェクト: isakatirci/NorthwindMVC
        public IBOProducts BOProducts()
        {
            var boProducts = new BOProducts()
            {
                ProductID       = this.ProductID,
                ProductName     = this.ProductName,
                SupplierID      = this.SupplierID,
                CategoryID      = this.CategoryID,
                QuantityPerUnit = this.QuantityPerUnit,
                UnitPrice       = this.UnitPrice,
                UnitsInStock    = this.UnitsInStock,
                UnitsOnOrder    = this.UnitsOnOrder,
                ReorderLevel    = this.ReorderLevel,
                Discontinued    = this.Discontinued
            };

            return(boProducts);
        }
コード例 #4
0
ファイル: ProductsVm.cs プロジェクト: isakatirci/NorthwindMVC
        public IBOProducts BOProducts()
        {
            var boProducts = new BOProducts()
            {
                Supplierİds            = this.Supplierİds,
                İd                     = this.İd,
                ProductCode            = this.ProductCode,
                ProductName            = this.ProductName,
                Description            = this.Description,
                StandardCost           = this.StandardCost,
                ListPrice              = this.ListPrice,
                ReorderLevel           = this.ReorderLevel,
                TargetLevel            = this.TargetLevel,
                QuantityPerUnit        = this.QuantityPerUnit,
                Discontinued           = this.Discontinued,
                MinimumReorderQuantity = this.MinimumReorderQuantity,
                Category               = this.Category,
                Attachments            = this.Attachments != null?Convert.FromBase64String(this.Attachments) : null
            };

            return(boProducts);
        }