Ejemplo n.º 1
0
 public int Update(CustomerView item)
 {
     try
     {
         Models.Entity.ChocoGearEntities db = new Entity.ChocoGearEntities();
         var q = db.Customers.Where(d => d.id == item.id).FirstOrDefault();
         q.id         = item.id;
         q.first_name = item.first_name;
         q.last_name  = item.last_name;
         q.phone      = item.phone;
         q.email      = item.email;
         q.address    = item.address;
         q.password   = item.password;
         db.SaveChanges();
         return(1);
     }
     catch (Exception)
     {
         return(0);
     }
 }
Ejemplo n.º 2
0
 public int Update(ProductView item)
 {
     try
     {
         Models.Entity.ChocoGearEntities db = new Entity.ChocoGearEntities();
         var q = db.Products.Where(d => d.id == item.id).FirstOrDefault();
         q.id           = item.id;
         q.name_product = item.name_product;
         q.name_image   = item.name_image;
         q.price        = item.price;
         q.description  = item.description;
         q.status       = item.status;
         q.id_category  = item.id_category;
         q.id_brand     = item.id_brand;
         db.SaveChanges();
         return(1);
     }
     catch (Exception)
     {
         return(0);
     }
 }