Exemple #1
0
		public void SaveContact(Order order, ContactItemInfoViewModel currentContact)
		{
			if (order == null)
			{
				throw new ArgumentNullException("order");
			}
			if (currentContact == null)
			{
				throw new ArgumentNullException("ContactItemInfoViewModel");
			}

			if (order.LoanAndContactInfo.Contacts == null)
			{
				order.LoanAndContactInfo.Contacts = new List<OrderContact>();
			}
			var contact = order.LoanAndContactInfo.Contacts.SingleOrDefault(e => e.Id.ToString() == currentContact.Id);
			if (contact == null)
			{
				contact = new OrderContact();
				order.LoanAndContactInfo.Contacts.Add(contact);
			}

			contact.ContactRoleId = currentContact.ContactRole.Value;
			contact.Name = currentContact.Name;
			contact.Phone = currentContact.Phone;
			contact.Email = currentContact.Email;
		}
		public ContactItemInfoViewModel(OrderContact model)
		{
			if (model != null)
			{
				this.Email = model.Email;
				this.Name = model.Name;
				this.Phone = model.Phone;
				this.Id = model.Id.ToString();
				this.ContactRole = model.ContactRoleId;

			}
		}