//
        // GET: /Contacts/Edit/5

        public ActionResult EditOrCreate(int parentEntityID, string parentEntityType, string contactSurname)
        {
            BusinessObjects.WorkManagement.Customer customer = null;
            BusinessObjects.WorkManagement.Contact contact = null;

            ViewBag.ParentEntityID = parentEntityID;
            ViewBag.ParentEntityType = parentEntityType;

            if (!string.IsNullOrEmpty(contactSurname))
            {
                switch (parentEntityType.ToUpper())
                {
                    case "ASSET":
                        {
                            BusinessObjects.WorkManagement.Asset asset = null;
                            asset = _modelContext.Assets.Find(p => p.ID == parentEntityID);
                            if (asset.Contact != null)
                            {
                                contact = asset.Contact;
                            }
                            break;
                        }
                    case "CUSTOMER":
                        {
                            customer = _modelContext.Customers.Find(p => p.ID == parentEntityID);
                            if (customer.Contacts != null)
                            {
                                contact = new List<BusinessObjects.WorkManagement.Contact>(customer.Contacts).Find(p => p.Surname == contactSurname);
                            }
                            break;
                        }
                    case "SUPPLIER":
                        {
                            break;
                        }
                }
            }

            if(contact == null)
            {
                contact = new BusinessObjects.WorkManagement.Contact();
            }

            return View(contact);
        }
        public BusinessObjects.WorkManagement.Contact CreateContactFromCustomerDetails(BusinessObjects.WorkManagement.Customer customer)
        {
            BusinessObjects.WorkManagement.Contact contact = null;

            contact = new BusinessObjects.WorkManagement.Contact { Surname = customer.Surname, TelephoneNo = customer.TelephoneNo, MobileNo = customer.MobileNo, EMail = customer.EMail,
            AlternativeTelephoneNo = customer.AlternativeTelephoneNo, CompanyName = customer.CompanyName, Forenames = customer.Forenames, Title = customer.Title};

            return contact;
        }