Ejemplo n.º 1
0
 public ActionResult Create(Product product)
 {
     try
     {
         _session.Store(product);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
Ejemplo n.º 2
0
        public ActionResult StoreSomeProductInDatabase()
        {
            var product = new Product
                              {
                                  Name = "Product Name",
                                  CategoryId = "category/1024",
                                  SupplierId = "supplier/16",
                                  Code = "H11050",
                                  StandardCost = 250,
                                  ListPrice = 189
                              };

            _session.Store(product);
            _session.SaveChanges();

            //return Content(product.Id);
            return RedirectToAction("Index");
        }
Ejemplo n.º 3
0
 //
 // GET: /Product/Create
 public ActionResult Create()
 {
     var model = new Product();
     return View(model);
 }
Ejemplo n.º 4
0
        public ActionResult InsertSomeMoreProducts()
        {
            for (int i = 0; i < 50; i++)
            {
                var product = new Product
                                  {
                                      Name = "Product Name " + i,
                                      CategoryId = "category/1024",
                                      SupplierId = "supplier/16",
                                      Code = "H11050" + i,
                                      StandardCost = 250 + (i*10),
                                      ListPrice = 189 + (i*10),
                                  };
                _session.Store(product);
            }

            _session.SaveChanges();

            //return Content("Products successfully created");
            return RedirectToAction("Index");
        }