public void TestInitialize() { target = new CrisisContactLogic(); dbContacts = new List <CrisisContact> { new CrisisContact { ID = 1, Contact = new Contact { ID = 1, Phone = "9375555555" }, Name = "Test 1" }, new CrisisContact { ID = 2, Contact = new Contact { ID = 2, Phone = "9375555556" }, Name = "Test 2" }, }; sampleDisplay = new CrisisContactDisplay { ContactId = 1, ID = 1, Name = "Test 1", PhoneNumber = "(937) 555-1234" }; }
/// <summary> /// Converts this display crisis contact to a database contact. /// </summary> /// <returns>DB version of the contact</returns> public CrisisContact ToDbCrisisContact() { CrisisContact dbContact; if (ID == 0) { //New crisis contact dbContact = new CrisisContact { Name = this.Name, Contact = new Contact { Phone = new string(this.PhoneNumber.Where(c => char.IsDigit(c)).ToArray()) } }; } else { var logics = new CrisisContactLogic(); //Go find the existing one and set changes dbContact = logics.GetDbCrisisContact(this.ID); dbContact.Name = this.Name; dbContact.Contact.Phone = this.PhoneNumber; } return(dbContact); }
/// <summary> /// Cris Contact API constructor /// </summary> public AppCrisisContactController() { this.logic = new CrisisContactLogic(); }
/// <summary> /// Crisis contacts controller constructor /// </summary> public CrisisContactAdminController() { logics = new CrisisContactLogic(); }