Пример #1
0
        public Pacient Update(Pacient pacientChanges)
        {
            var pacient = context.Pacienti.Attach(pacientChanges);

            pacient.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            context.SaveChanges();
            return(pacientChanges);
        }
Пример #2
0
        public Pacient Delete(int id)
        {
            Pacient pacient = context.Pacienti.Find(id);

            if (pacient != null)
            {
                context.Pacienti.Remove(pacient);
                context.SaveChanges();
            }
            return(pacient);
        }
Пример #3
0
 public Pacient Add(Pacient pacient)
 {
     context.Pacienti.Add(pacient);
     context.SaveChanges();
     return(pacient);
 }