Пример #1
0
 public void UpdateUser(User user)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         appContext.Entry <User>(user).State = EntityState.Modified;
         appContext.SaveChanges();
     }
 }
Пример #2
0
 public void UpdateShop(Shop shop)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         appContext.Entry <Shop>(shop).State = EntityState.Modified;
         appContext.SaveChanges();
     }
 }
Пример #3
0
 public void UpdateTypeOfShop(TypeOfShop typeOfShop)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         appContext.Entry <TypeOfShop>(typeOfShop).State = EntityState.Modified;
         appContext.SaveChanges();
     }
 }
Пример #4
0
 public void UpdateAddress(Address address)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         appContext.Entry <Address>(address).State = EntityState.Modified;
         appContext.SaveChanges();
     }
 }
Пример #5
0
 public void SetRate(Rating rating, User user, Shop shop, int rate)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         rating.User   = user;
         rating.Shop   = shop;
         rating.IdUser = user.IdUser;
         rating.IdShop = shop.IdShop;
         rating.Rate   = rate;
         appContext.Entry <Rating>(rating).State = EntityState.Modified;
         appContext.SaveChanges();
     }
 }
Пример #6
0
 public Repas Enregistrer(Repas repas)
 {
     using (Entities.AppContext context = new Entities.AppContext())
     {
         if (repas.Id > 0)
         {
             context.Repas.Attach(repas);
             context.Entry(repas).State = System.Data.Entity.EntityState.Modified;
         }
         else
         {
             context.Repas.Add(repas);
         }
         context.SaveChanges();
     }
     return(repas);
 }
Пример #7
0
 public Client Enregistrer(Client cli)
 {
     using (Entities.AppContext context = new Entities.AppContext())
     {
         if (cli.IdentifiantCli > 0)
         {
             context.Clients.Attach(cli);
             context.Entry(cli).State = System.Data.Entity.EntityState.Modified;
         }
         else
         {
             context.Clients.Add(cli);
         }
         context.SaveChanges();
     }
     return(cli);
 }