Ejemplo n.º 1
0
        public ActionResult Create([Bind(Include = "Id,Dato,Sum,ID_Manager,ID_Client,ID_Product")] SaleInfo saleInfo)
        {
            if (ModelState.IsValid)
            {
                db.SaleInfo.Add(saleInfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ID_Client  = new SelectList(db.Client, "Id", "ClientName", saleInfo.ID_Client);
            ViewBag.ID_Manager = new SelectList(db.Manager, "Id", "ManagerName", saleInfo.ID_Manager);
            ViewBag.ID_Product = new SelectList(db.Product, "Id", "ProductName", saleInfo.ID_Product);
            return(View(saleInfo));
        }
Ejemplo n.º 2
0
 public void Update(T item)
 {
     using (var context = new ModelDataEntities2())
     {
         context.Entry(item).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 public int Insert(T item)
 {
     using (var context = new ModelDataEntities2())
     {
         var entity = context.Set <T>().Add(item);
         context.SaveChanges();
         return(item.Id);
     }
 }