Esempio n. 1
0
 public void AddTypePromotion(ModelTypePromotions model)
 {
     using (var db = new DAL.BikeEntities())
     {
         db.TypePromotions.Add(MapToDB(model));
         db.SaveChanges();
     }
 }
Esempio n. 2
0
 public void AddBodyRent(ModelBodyRents model)
 {
     using (var db = new DAL.BikeEntities())
     {
         db.BodyRents.Add(MapToDB(model));
         db.SaveChanges();
     }
 }
Esempio n. 3
0
 public void DeleteTypePromotion(int id)
 {
     using (var db = new DAL.BikeEntities())
     {
         var aDelete = db.TypePromotions.Find(id);
         db.TypePromotions.Remove(aDelete);
         db.SaveChanges();
     }
 }
Esempio n. 4
0
 public void EditTypeRent(ModelTypeRents model)
 {
     using (var db = new DAL.BikeEntities())
     {
         var aEdit = db.TypeRents.Find(model.id);
         aEdit.name  = model.name;
         aEdit.price = model.price;
         db.SaveChanges();
     }
 }
Esempio n. 5
0
 public void EditTypePromotion(ModelTypePromotions model)
 {
     using (var db = new DAL.BikeEntities())
     {
         var aEdit = db.TypePromotions.Find(model.id);
         aEdit.name         = model.name;
         aEdit.discount     = model.discount;
         aEdit.quantity_min = model.quantity_min;
         aEdit.quantity_max = model.quantity_max;
         db.SaveChanges();
     }
 }
Esempio n. 6
0
 public void AddClient(ModelClients model)
 {
     try
     {
         using (var db = new DAL.BikeEntities())
         {
             db.Clients.Add(MapToDB(model));
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 7
0
 public void DeleteRent(int id)
 {
     try
     {
         using (var db = new DAL.BikeEntities())
         {
             var aDelet = db.Rents.Find(id);
             db.Rents.Remove(aDelet);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 8
0
 public int AddRent(ModelRents model)
 {
     try
     {
         using (var db = new DAL.BikeEntities())
         {
             db.Rents.Add(MapToDB(model));
             db.SaveChanges();
             return(MapToApp(db.Set <DAL.Rents>().OrderByDescending(t => t.id).FirstOrDefault()).id);
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
Esempio n. 9
0
 public void EditClient(ModelClients model)
 {
     try
     {
         using (var db = new DAL.BikeEntities())
         {
             var aEdit = db.Clients.Find(model.id);
             aEdit.name      = model.name;
             aEdit.surname   = model.surname;
             aEdit.email     = model.email;
             aEdit.telephone = model.telephone;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
     }
 }