public dynamic PostPurchaseOrderDetails(PostPurchaseOrderDetailsVM p)
        {
            var purchaseOrderDetails = db.PurchaseOrderDetails.Add(new PurchaseOrderDetail
            {
                PurchaseOrderId     = p.purchaseOrderId,
                BrandId             = p.brandId,
                ModelId             = p.modelId,
                ManufacturingYearId = p.manufacturingYearId,
                CategoryId          = p.categoryId,
                ColorId             = p.colorId,
                IsNew = p.isNew,
                Count = p.count,
                Price = p.price
            });
            var result = db.SaveChanges() > 0 ? true : false;

            return(new
            {
                result = result,
                //M.Hamed Add Price*Count to developr to sum total for all items
                //from purchaseOrderDetailsPrice = purchaseOrderDetails.Price
                purchaseOrderDetailsPrice = purchaseOrderDetails.Price * purchaseOrderDetails.Count,
                purchaseOrderDetailsId = purchaseOrderDetails.Id
            });
        }
        public dynamic PutPurchaseOrderDetails(PostPurchaseOrderDetailsVM p)
        {
            var purchaseOrderDetails = db.PurchaseOrderDetails.Find(p.id);

            purchaseOrderDetails.PurchaseOrderId     = p.purchaseOrderId;
            purchaseOrderDetails.BrandId             = p.brandId;
            purchaseOrderDetails.ModelId             = p.modelId;
            purchaseOrderDetails.ManufacturingYearId = p.manufacturingYearId;
            purchaseOrderDetails.CategoryId          = p.categoryId;
            purchaseOrderDetails.ColorId             = p.colorId;
            purchaseOrderDetails.IsNew = p.isNew;
            purchaseOrderDetails.Count = p.count;
            purchaseOrderDetails.Price = p.price;
            var result = db.SaveChanges() > 0 ? true : false;

            return(new
            {
                reslt = result,
                purchaseOrderDetailsPrice = purchaseOrderDetails.Price * purchaseOrderDetails.Count
            });
        }