Ejemplo n.º 1
0
 public void CreatePerson(PersonModels person)
 {
     try
     {
         int maxId = peopleList.Count == 0 ? 0 : peopleList.Select(item => item.Id).Max();
         person.Id = maxId + 1;
         peopleList.Add(person);
     }
     catch (Exception)
     { }
 }
Ejemplo n.º 2
0
 public void UpdatePerson(PersonModels person)
 {
     try
     {
         //foreach (BookModels bm in booksList)
         //{
         //    if (bm.Id == bookModel.Id)
         //    {
         //        booksList.Remove(bm);
         //        booksList.Add(bookModel);
         //        break;
         //    }
         //}
         PersonModels pm = peopleList.Find(item => item.Id == person.Id);
         pm.Name     = person.Name;
         pm.Surname  = person.Surname;
         pm.Position = person.Position;
     }
     catch (Exception)
     {
     }
 }