Пример #1
0
 public void AddParrents(Parrents parrents)
 {
     using (var context = new RabbitsDBEntities())
     {
         context.Parrents.Add(parrents);
         context.SaveChanges();
     }
 }
Пример #2
0
        public void UpdateParrents(Parrents parrents)
        {
            using (var context = new RabbitsDBEntities())
            {
                var entity = context.Parrents.FirstOrDefault(x => x.Id == parrents.Id);

                if(entity == null)
                    throw new InvalidOperationException(NotFound);

                entity.FatherId1 = parrents.FatherId1;
                entity.FatherId2 = parrents.FatherId2;
                entity.MotherId = parrents.MotherId;

                context.SaveChanges();
            }
        }