Exemple #1
0
 public List <Payload> findAll()
 {
     using (PayPeopleEntities ppe = new PayPeopleEntities())
     {
         return(ppe.PayloadEntities.Select(pe => new Payload
         {
             FirstName = pe.FirstName,
             LastName = pe.LastName,
             Age = pe.Age,
             Gender = pe.Gender,
             Email = pe.Email,
             Registered = pe.Registered
         }).ToList());
     }
 }
Exemple #2
0
 public bool create(Payload payload)
 {
     using (PayPeopleEntities ppe = new PayPeopleEntities())
     {
         try
         {
             PayloadEntity pe = new PayloadEntity();
             pe.FirstName = payload.FirstName;
             pe.LastName  = payload.LastName;
             pe.Age       = payload.Age;
             pe.Gender    = payload.Gender;
             pe.Email     = payload.Email;
             ppe.PayloadEntities.Add(pe);
             ppe.SaveChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     };
 }