public void DeleteEntity(Guid id) { using (var context = new TrashDomainContext(this.ConnectionString)) { var personSymptom = context.PersonSymptoms.FirstOrDefault(v => v.Id == id); if (personSymptom == null) { return; } context.PersonSymptoms.Remove(personSymptom); context.SaveChanges(); } }
public void DeleteEntity(Guid id) { using (var context = new TrashDomainContext(this.ConnectionString)) { var measuringNotification = context.MeasuringNotifications.FirstOrDefault(v => v.Id == id); if (measuringNotification == null) { return; } context.MeasuringNotifications.Remove(measuringNotification); context.SaveChanges(); } }
public PersonSymptom CreateOrUpdateEntity(PersonSymptom entity) { if (entity == null) { throw new ArgumentNullException("entity"); } using (var context = new TrashDomainContext(this.ConnectionString)) { if (this.GetEntityById(entity.Id) == null) { context.PersonSymptoms.Add(entity); } else { context.Entry(entity).State = EntityState.Modified; } context.SaveChanges(); } return entity; }