コード例 #1
0
        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();
            }
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        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;
        }