コード例 #1
0
        public void ActualizarPrducto(int prd_id, int?prd_cnt)
        {
            Producto prd = ProductoBLL.Get(prd_id);

            prd.prd_cnt -= prd_cnt;
            ProductoBLL.Update(prd);
        }
コード例 #2
0
 public static void Delete(int?id)
 {
     using (emmcomerseEntities db = new emmcomerseEntities())
     {
         using (var transaction = db.Database.BeginTransaction())
         {
             try
             {
                 ProductoEnCarrito ProductoEnCarrito = db.ProductoEnCarrito.Find(id);
                 db.Entry(ProductoEnCarrito).State = System.Data.Entity.EntityState.Deleted;
                 db.SaveChanges();
                 transaction.Commit();
                 ProductoBLL.Update(ProductoEnCarrito.prd_id, (-1 * ProductoEnCarrito.prd_cnt));
             }
             catch (Exception ex)
             {
                 transaction.Rollback();
                 throw ex;
             }
         }
     }
 }
コード例 #3
0
 public static void Create(ProductoEnCarrito a)
 {
     using (emmcomerseEntities db = new emmcomerseEntities())
     {
         using (var transaction = db.Database.BeginTransaction())
         {
             try
             {
                 a.pcr_est           = "Pendiente";
                 a.pcr_dateOfCreated = DateTime.Now;
                 db.ProductoEnCarrito.Add(a);
                 db.SaveChanges();
                 transaction.Commit();
                 ProductoBLL.Update(a.prd_id, a.prd_cnt);
             }
             catch (Exception ex)
             {
                 transaction.Rollback();
                 throw ex;
             }
         }
     }
 }