Ejemplo n.º 1
0
        public void Inser(string fName, string lName, string identityCode, string telNumber, string phoneNumber)
        {
            using (var context = new Model.DomainModel.DTO.EF.ContactEntities1())
            {
                try
                {
                    var person = new DTO.EF.Person();

                    person.FirstName       = fName;
                    person.LastName        = lName;
                    person.IdentityCode    = identityCode;
                    person.TelephoneNumber = telNumber;
                    person.PhoneNumber     = phoneNumber;
                    if (true)
                    {
                    }
                    context.Person.Add(person);
                    context.SaveChanges();
                }
                catch (Exception ex)
                {
                    ErrorMessage = ex.Message + " " + ex.TargetSite;
                    throw;
                }
                finally
                {
                    context.Dispose();
                }
            }
        }
Ejemplo n.º 2
0
 public List <Model.DomainModel.DTO.EF.Person> SelectAll()
 {
     using (var context = new Model.DomainModel.DTO.EF.ContactEntities1())
     {
         try
         {
             var q = context.Person.ToList();
             return(q);
         }
         catch (Exception ex)
         {
             ErrorMessage = ex.Message + " " + ex.TargetSite;
             throw;
         }
         finally
         {
             context.Dispose();
         }
     }
 }
Ejemplo n.º 3
0
 public void Delete(DTO.EF.Person person)
 {
     using (var context = new Model.DomainModel.DTO.EF.ContactEntities1())
     {
         try
         {
             context.Entry(person).State = System.Data.Entity.EntityState.Deleted;
             context.SaveChanges();
         }
         catch (Exception ex)
         {
             ErrorMessage = ex.Message + " " + ex.TargetSite;
             throw;
         }
         finally
         {
             context.Dispose();
         }
     }
 }