當前位置: 首頁>>代碼示例>>C#>>正文


C# Models.Product類代碼示例

本文整理匯總了C#中Models.Product的典型用法代碼示例。如果您正苦於以下問題:C# Product類的具體用法?C# Product怎麽用?C# Product使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Product類屬於Models命名空間,在下文中一共展示了Product類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BeginPutNonRetry400Async

 /// <summary>
 /// Long running put request, service returns a 400 to the initial request
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='product'>
 /// Product to put
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task<Product> BeginPutNonRetry400Async(this ILROSADsOperations operations, Product product = default(Product), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.BeginPutNonRetry400WithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false))
     {
         return _result.Body;
     }
 }
開發者ID:Ranjana1996,項目名稱:autorest,代碼行數:19,代碼來源:LROSADsOperationsExtensions.cs

示例2: DeepCopyProduct

        /// <summary>
        /// Makes deep copy of Product.
        /// Entity Framework cannot keep track of 1 item in 2 contexts, so in order to
        /// export something and import it in other database it needs deep copy of it.
        /// </summary>
        /// <param name="product">Product for copy.</param>
        /// <param name="vendor">Product's vendor.</param>
        /// <returns>Deep copy of the product</returns>
        private static Product DeepCopyProduct(Product product, Vendor vendor)
        {
            var incomes = product.Incomes
                .Select(income => new Income()
                {
                    Quantity = income.Quantity,
                    SalePrice = income.SalePrice
                })
                .ToList();

            var expenses = product.Vendor.Expenses
                .Select(expense => new Expense()
                {
                    Amount = expense.Amount,
                })
                .ToList();

            foreach (var expense in expenses)
            {
                vendor.Expenses.Add(expense);
            }

            var deepCopyProduct = new Product()
            {
                Name = product.Name,
                BuyingPrice = product.BuyingPrice,
                Incomes = incomes,
                Vendor = vendor
            };

            return deepCopyProduct;
        }
開發者ID:Team-Sunflower-Sunbright,項目名稱:DatabaseApps-Teamwork,代碼行數:40,代碼來源:MySqlImporter.cs

示例3: Put200SucceededAsync

 /// <summary>
 /// Long running put request, service returns a 200 to the initial request,
 /// with an entity that contains ProvisioningState=’Succeeded’.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='product'>
 /// Product to put
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task<Product> Put200SucceededAsync(this ILROsOperations operations, Product product = default(Product), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.Put200SucceededWithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false))
     {
         return _result.Body;
     }
 }
開發者ID:Ranjana1996,項目名稱:autorest,代碼行數:20,代碼來源:LROsOperationsExtensions.cs

示例4: GetProductAsync

 /// <summary>
 /// Product Types
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='responseCode'>
 /// The desired returned status code
 /// </param>
 /// <param name='product'>
 /// The only parameter
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task<Product> GetProductAsync(this ISwaggerDataTypesClient operations, string responseCode = default(string), Product product = default(Product), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetProductWithHttpMessagesAsync(responseCode, product, null, cancellationToken).ConfigureAwait(false))
     {
         return _result.Body;
     }
 }
開發者ID:Ranjana1996,項目名稱:autorest,代碼行數:22,代碼來源:SwaggerDataTypesClientExtensions.cs

示例5: PostAsync

 /// <summary>
 /// Products
 /// </summary>
 /// The Products endpoint returns information about the Uber products offered
 /// at a given location. The response includes the display name and other
 /// details about each product, and lists the products in the proper display
 /// order.
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// Subscription Id.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Resource Group Id.
 /// </param>
 /// <param name='apiVersion'>
 /// API Id.
 /// </param>
 /// <param name='body'>
 /// API body mody.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task<Product> PostAsync( this IRecursiveTypesAPI operations, string subscriptionId, string resourceGroupName, string apiVersion, Product body = default(Product), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.PostWithHttpMessagesAsync(subscriptionId, resourceGroupName, apiVersion, body, null, cancellationToken).ConfigureAwait(false))
     {
         return _result.Body;
     }
 }
開發者ID:ahirmayur,項目名稱:autorest,代碼行數:32,代碼來源:RecursiveTypesAPIExtensions.cs

示例6: Put201CreatingSucceeded200Async

 /// <summary>
 /// Long running put request, service returns a 500, then a 201 to the initial
 /// request, with an entity that contains ProvisioningState=’Creating’.
 /// Polls return this value until the last poll returns a ‘200’ with
 /// ProvisioningState=’Succeeded’
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='product'>
 /// Product to put
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async System.Threading.Tasks.Task<Product> Put201CreatingSucceeded200Async(this ILRORetrysOperations operations, Product product = default(Product), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.Put201CreatingSucceeded200WithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false))
     {
         return _result.Body;
     }
 }
開發者ID:DeepakRajendranMsft,項目名稱:autorest,代碼行數:22,代碼來源:LRORetrysOperationsExtensions.cs

示例7: Delete

 public void Delete(Product product)
 {
     var products = db.GetCollection<Product>("Products");
     var query = Query.And(Query.EQ("Price", product.Price), Query.EQ("Name", product.Name));
     var findAndRemoveArguments = new FindAndRemoveArgs();
     findAndRemoveArguments.Query = query;
     products.FindAndRemove(findAndRemoveArguments);
 }
開發者ID:TelerikAcademyTeamTitanium,項目名稱:DatabaseProject,代碼行數:8,代碼來源:DefaultProductsDAO.cs

示例8: insert_Click

 private void insert_Click(object sender, EventArgs e)
 {
     Product product = new Product
     {
         Id = Int32.Parse(insertId.Text),
         Name = insertName.Text,
         Price = Double.Parse(insertPrice.Text),
         Quantity = Int32.Parse(insertQuantity.Text)
     };
     DbAccessor accessor = DbAccessor.Instance;
     accessor.CreateProduct(product);
 }
開發者ID:shawn-l,項目名稱:SalesSystem,代碼行數:12,代碼來源:ProductForm.cs

示例9: Edit

 public ActionResult Edit(Product model, int id)
 {
     if (ModelState.IsValid)
     {
         _models.Remove(_models.Get(id));
         model.Id = id;
         _models.Add(model);
         Success("The model was updated!");
         return RedirectToAction("index");
     }
     return View("Create", model);
 }
開發者ID:erangeljr,項目名稱:newrelic-dot-net-kata,代碼行數:12,代碼來源:ProductController.cs

示例10: Create

 public ActionResult Create(Product model)
 {
     if (ModelState.IsValid)
     {
         model.Id = _models.Count == 0 ? 1 : _models.Select(x => x.Id).Max() + 1;
         _models.Add(model);
         Success("Your information was saved!");
         return RedirectToAction("Index");
     }
     Error("there were some errors in your form.");
     return View(model);
 }
開發者ID:erangeljr,項目名稱:newrelic-dot-net-kata,代碼行數:12,代碼來源:ProductController.cs

示例11: Insert

 public ActionResult Insert()
 {
     using (var db = new NorthwindDataContext())
     {
         var product = new Product();
         if (TryUpdateModel(product))
         {
             db.Products.InsertOnSubmit(product);
             db.SubmitChanges();
         }
     }
     return GetView();
 }
開發者ID:mwassem,項目名稱:extensions-for-asp-net-mvc-discontinued,代碼行數:13,代碼來源:HomeController.cs

示例12: Create

 public ActionResult Create(Product product)
 {
     try
     {
         productRepository.Add(product);
         productRepository.Save();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
開發者ID:jchannon,項目名稱:EntityFrameworkMVC,代碼行數:13,代碼來源:ProductController.cs

示例13: InsertProduct

        public string InsertProduct(Product product)
        {
            try
            {
                GarageEntities db = new GarageEntities();
                db.Products.Add(product);
                db.SaveChanges();

                return product.Name + " was succesfully inserted";
            }
            catch (Exception e)
            {
                return "Error:" + e;
            }
        }
開發者ID:henrypedersen77,項目名稱:GarageManagerMaster,代碼行數:15,代碼來源:ProductModel.cs

示例14: Create

 public ActionResult Create(Product product,HttpPostedFileBase file,FormCollection values)
 {
     if (ModelState.IsValid)
     {
         if (file != null)
         {
             product.ProductStores = new List<ProductStore>();
             product.ProductStores.Add(new ProductStore { SellPrice = Convert.ToDecimal(values["SellPrice"]), TimeCreated = DateTime.Now, });
             product.Image = new byte[file.ContentLength];
             file.InputStream.Read(product.Image, 0, file.ContentLength);
             storeDB.Products.Add(product);
             storeDB.SaveChanges();
         }
         return RedirectToAction("");
     }
     ViewBag.CategorieID = new SelectList(storeDB.Caegories, "CategorieID", "Name");
     return View();
 }
開發者ID:alireza1735,項目名稱:TGH,代碼行數:18,代碼來源:ProductController.cs

示例15: ListAll

        public List<Product> ListAll()
        {
            _products = new List<Product>();
            string[] reader = File.ReadAllLines(FilePath);

            for (int i = 1; i < reader.Length; i++)
            {
                var columns = reader[i].Split(',');

                var product = new Product
                {
                    ProductType = columns[0],
                    CostPerSquareFoot= decimal.Parse(columns[1]),
                    LaborCostPerSquareFoot = decimal.Parse(columns[2]),
                };

                _products.Add(product);
            }

            return _products;
        }
開發者ID:jmullins1992,項目名稱:Portfolio,代碼行數:21,代碼來源:ProductRepository.cs


注:本文中的Models.Product類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。