public static void AddNewContact(DeserializedPerson person)
        {
            Person p = new Person
            {
                firstName = person.firstName,
                lastName  = person.lastName
            };
            Person_address pa = new Person_address
            {
                houseNum        = person.houseNum,
                street          = person.street,
                address_city    = person.city,
                address_state   = person.state,
                address_country = person.country,
                zipcode         = person.zipcode
            };

            pa.People.Add(p);
            Person_phone pp = new Person_phone {
                countryCode = person.countryCode,
                areaCode    = person.areaCode,
                number      = person.number,
                ext         = person.ext,
                Person      = p
            };

            AddToDatabase(p);
            AddToDatabase(pa);
            AddToDatabase(pp);
        }
        public static string Edit(ref int opt, Person_phone phone, string text)
        {
            switch (opt)
            {
            case 1:
                try
                {
                    phone.countryCode = (int)Enum.Parse(typeof(Country), text);
                    return(Save());
                }
                catch (Exception ex)
                {
                    logger.Error(ex, "DatabaseAction.Edit BadInput Error");
                    return("Invalid Country!");
                }

            case 2:
                phone.areaCode = Convert.ToInt32(text);
                return(Save());

            case 3:
                phone.number = Convert.ToInt32(text);
                return(Save());

            case 4:
                phone.ext = Convert.ToInt32(text);
                return(Save());

            default:
                return("No Information Updated");
            }
        }
 public static Person_phone AddNewContact(Person p, int countrycode, int areacode, int number, int ext)
 {
     pp = new Person_phone
     {
         Person      = p,
         countryCode = countrycode,
         areaCode    = areacode,
         number      = number,
         ext         = ext
     };
     return(pp);
 }
 public static Person_phone FindPhoneID(int ID)
 {
     try
     {
         Person_phone phone = db.Person_phone.Single(pp => pp.PHid == ID);
         return(phone);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "DatabaseAction.Find Null Error");
         return(null);
     }
 }
 public static void AddToDatabase(Person_phone pp)
 {
     db.Person_phone.Add(pp);
 }
 public static string Del(Person_phone phone)
 {
     db.Person_phone.Remove(phone);
     return(Save());
 }