public void Update(Color entity) { using (ReCapDemoDbContex1 context = new ReCapDemoDbContex1()) { var updatedEntity = context.Entry(entity); updatedEntity.State = EntityState.Modified; context.SaveChanges(); } }
public void Delete(Color entity) { using (ReCapDemoDbContex1 context = new ReCapDemoDbContex1()) { var deletedEntity = context.Entry(entity); deletedEntity.State = EntityState.Deleted; context.SaveChanges(); } }
public void Add(Brand entity) { using (ReCapDemoDbContex1 context = new ReCapDemoDbContex1()) { var addedEntity = context.Entry(entity); addedEntity.State = Microsoft.EntityFrameworkCore.EntityState.Added; context.SaveChanges(); } }
public void Add(Color entity) { using (ReCapDemoDbContex1 context = new ReCapDemoDbContex1()) { var addedEntity = context.Entry(entity); addedEntity.State = EntityState.Added; context.SaveChanges(); } }
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."); } }