예제 #1
0
 public void Update(Color entity)
 {
     using (ReCapDemoDbContex1 context = new ReCapDemoDbContex1())
     {
         var updatedEntity = context.Entry(entity);
         updatedEntity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
예제 #2
0
 public void Delete(Color entity)
 {
     using (ReCapDemoDbContex1 context = new ReCapDemoDbContex1())
     {
         var deletedEntity = context.Entry(entity);
         deletedEntity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
예제 #3
0
 public void Add(Brand entity)
 {
     using (ReCapDemoDbContex1 context = new ReCapDemoDbContex1())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = Microsoft.EntityFrameworkCore.EntityState.Added;
         context.SaveChanges();
     }
 }
예제 #4
0
 public void Add(Color entity)
 {
     using (ReCapDemoDbContex1 context = new ReCapDemoDbContex1())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Added;
         context.SaveChanges();
     }
 }
예제 #5
0
 public void Add(Car entity)
 {
     if (entity.Description.Length > 2 && entity.DailyPrices > 0)
     {
         using (ReCapDemoDbContex1 context = new ReCapDemoDbContex1())
         {
             var addedEntity = context.Entry(entity);
             addedEntity.State = EntityState.Added;
             context.SaveChanges();
         }
     }
     else
     {
         Console.WriteLine("Girdiginiz değerlere uyan bir araç olamaz.");
     }
 }