当前位置: 首页>>代码示例>>C#>>正文


C# ProductRepository.Update方法代码示例

本文整理汇总了C#中ProductRepository.Update方法的典型用法代码示例。如果您正苦于以下问题:C# ProductRepository.Update方法的具体用法?C# ProductRepository.Update怎么用?C# ProductRepository.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProductRepository的用法示例。


在下文中一共展示了ProductRepository.Update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

        public ActionResult Update(Product produto )
        {
            ProductRepository<Product> dao = new ProductRepository<Product>();
            dao.Update(produto);

            return RedirectToAction("index", "Product");
        }
开发者ID:MarceloNascimento,项目名称:SICPROD,代码行数:7,代码来源:ProductController.cs

示例2: Put

 // PUT api/products/5
 public IEnumerable<Product> Put(int id, [FromBody]Product value)
 {
     ProductRepository repo = new ProductRepository();
     value.ProductId = id;
     repo.Update(value);
     return repo.Retrieve();
 }
开发者ID:pankaj-dhami,项目名称:AngularWebApi,代码行数:8,代码来源:ProductsController.cs

示例3: Edit

        public ActionResult Edit(Product product)
        {
            if (ModelState.IsValid)
            {
                ProductRepository p = new ProductRepository(_sqlConnectionString);
                p.Update(product);
                return RedirectToAction("Index");
            }

            return View(product);
        }
开发者ID:MarneeDear,项目名称:Terminal-Management-Applications,代码行数:11,代码来源:ProductsController.cs

示例4: ShouldUpdateAProduct

 public void ShouldUpdateAProduct()
 {
     var productRepository = new ProductRepository(@"Repository\Products.txt", "Product");
     productRepository.Update(2,new Product
     {
         Category = "Fruits",
         Name = "Appel",
         Price = 12,
         Stock = 3
     });
     var products = productRepository.GetAll().ToArray();
     Assert.AreEqual("Appel",products[1].Name);
 }
开发者ID:florentinac,项目名称:repository,代码行数:13,代码来源:ProductRepository.Tests.cs

示例5: RepositoryUpdateTest

 public void RepositoryUpdateTest()
 {
     Program.ClearInformation();
     IRepository<Product> _productRepository = new ProductRepository();
     Product product = new Product(1, "House", "MOPRa,1", "for sale");
     _productRepository.Add(product);
     product.status = "saled";
     _productRepository.Update(product);
     Product actual = _productRepository.GetItem(product.id);
     Product expected = new Product(1, "House", "MOPRa,1", "saled");
     Assert.AreEqual(actual.id, product.id);
     Assert.AreEqual(actual.name, product.name);
     Assert.AreEqual(actual.status, product.status);
     Assert.AreEqual(actual.address, product.address);
     Program.ClearInformation();
 }
开发者ID:WilliamRobertMontgomery,项目名称:asp-dot-net-training-project,代码行数:16,代码来源:Tests.cs

示例6: Buy

 public ActionResult Buy(Product product)
 {
     IRepository<Product> _productRepository = new ProductRepository();
     Product buyingProduct = _productRepository.GetItem(product.id);
     if (buyingProduct.status == "saled")
     {
         return RedirectToAction("ErrorOfSaledProduct");
     }
     else
     {
         buyingProduct.status = "saled";
         _productRepository.Update(buyingProduct);
         return RedirectToAction("Shop");
     }
 }
开发者ID:WilliamRobertMontgomery,项目名称:asp-dot-net-training-project,代码行数:15,代码来源:HomeController.cs


注:本文中的ProductRepository.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。