예제 #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();
                }
            }
        }
예제 #2
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();
         }
     }
 }