Exemplo n.º 1
0
        //private IQueryable<Person> person;

        public void DoAddData(DateTime date, string name)
        {
            using (PersonDb db = new PersonDb())
            {
                Person person = new Person {
                    Id = 1, Date = date, Name = name
                };
                db.Persons.Add(person);
                db.SaveChanges();
            }
        }
Exemplo n.º 2
0
 public void DoRemoveData(string name)
 {
     using (PersonDb db = new PersonDb())
     {
         foreach (Person man in db.Persons)
         {
             //if(man.Name == name || man.Id == int.Parse(name) || man.Date == name)
             if (man.Name == name || man.Id == int.Parse(name))
             {
                 db.Persons.Remove(man);
             }
         }
         db.SaveChanges();
     }
 }