Beispiel #1
0
 public void Update(Car Entity)
 {
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var updatedCar = context.Entry(Entity);
         updatedCar.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Beispiel #2
0
 public void Update(Car entity)
 {
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var updatedEntity = context.Entry(entity);  //ref. yakala
         updatedEntity.State = EntityState.Modified; //o aslında güncel. nesne
         context.SaveChanges();                      //gün
     }
 }
Beispiel #3
0
 public void Delete(Car Entity)
 {
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var deletedCar = context.Entry(Entity);
         deletedCar.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Beispiel #4
0
 public void Add(Color Entity)
 {
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var addedColor = context.Entry(Entity);
         addedColor.State = EntityState.Added;
         context.SaveChanges();
     }
 }
Beispiel #5
0
 public void Update(Car entity)
 {
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var updatedEntity = context.Entry(entity); //gelen parametredeki özelliklerde olan nesneyi eşleştir
         updatedEntity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Beispiel #6
0
 public void Delete(Car entity)
 {
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var deletedEntity = context.Entry(entity); //ref. yakala
         deletedEntity.State = EntityState.Deleted; //o aslında eklenecek nesne
         context.SaveChanges();                     //ekle
     }
 }
 public void Update(Rental entity)
 {
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var updateEntity = context.Entry(entity);
         updateEntity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void Delete(Rental entity)
 {
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var deletedEntity = context.Entry(entity);
         deletedEntity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
 public void Add(Rental entity)
 {
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Added;
         context.SaveChanges();
     }
 }
 public void Update(Color entity)
 {
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var updatedEntity = context.Entry(entity);
         updatedEntity.State = EntityState.Added;
         context.SaveChanges();
     }
 }
Beispiel #11
0
 public void Add(Car entity)
 {
     //IDisposable pattern implementation of c#
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var addedEntity = context.Entry(entity); //ref. yakala
         addedEntity.State = EntityState.Added;   //o aslında eklenecek nesne
         context.SaveChanges();                   //ekle
     }
 }
Beispiel #12
0
        public void Add(Car Entity)
        {
            using (ReCapProjectContext context = new ReCapProjectContext())
            {
                var addedCar = context.Entry(Entity);

                if (addedCar.Entity.Description.Length >= 2 && addedCar.Entity.DailyPrice > 0)
                {
                    Console.WriteLine("Araba açıklaması en az 2 karakter olmalıdır.");
                }
                else if (addedCar.Entity.Description.Length >= 2 && addedCar.Entity.DailyPrice < 0)
                {
                    Console.WriteLine("Araba günlük fiyatı 0 dan büyük olmalıdır.");
                }
                else
                {
                    addedCar.State = EntityState.Added;
                    context.SaveChanges();
                }
            }
        }