public List <ContactsFullModel> GetContacts(string contactId) { var newFullModel = new ContactsFullModel(); var dataRecords = _dataAccess.DataSelect(newFullModel, ContactsTablename, ContactID, contactId); return(dataRecords.Select(_mapperContacts.MapDictionaryToFullContactsModel).ToList()); }
public ActionResult Contact(ContactsFullModel contactsModel) { var id = string.Empty; if (string.IsNullOrEmpty(contactsModel.ID)) { id = BuilderContacts.EnterNewContact(BuilderContacts.BuildMapToContactsModel(contactsModel)); } else { BuilderContacts.UpdateContact(contactsModel); id = contactsModel.ID; } return(RedirectToAction("Contact", "View", new { id })); }
public ActionResult Contact(string id) { var model = new ContactsFullModel(); if (!string.IsNullOrEmpty(id)) { model = BuilderContacts.GetContacts(id).FirstOrDefault(); } else {//new contact with empty model to fill out model = BuilderContacts.BuildEmptyContactsModel().FirstOrDefault(); } model.CustomerTypeList = BuilderContacts.GetContactTypes(); return(View("ContactsEdit", model)); }
public ContactsModel MapToContactsModel(ContactsFullModel fullModel) { return(new ContactsModel() { FirstName = fullModel.FirstName, LastName = fullModel.LastName, MobleNumber = fullModel.MobleNumber, PhoneNumber = fullModel.PhoneNumber, EmailAddress = fullModel.EmailAddress, CustomerType = fullModel.CustomerType, BillingAddress = fullModel.BillingAddress, City = fullModel.City, CountryRegion = fullModel.CountryRegion, PostalCode = fullModel.PostalCode, StateOrProvince = fullModel.StateOrProvince }); }
public ContactsFullModel AddContactTypes(ContactsFullModel objModel) { objModel.CustomerTypeList = GetContactTypes(); return(objModel); }
public ContactsModel BuildMapToContactsModel(ContactsFullModel fullModel) { return(_mapperContacts.MapToContactsModel(fullModel)); }
public void UpdateContact(ContactsFullModel newContact) { _dataAccess.DataUpdate(_mapperContacts.MapToContactsModel(newContact), ContactsTablename, ContactID, Convert.ToInt32(newContact.ID)); }