public ActionResult Create(string TagId, string TagName, string firstname, string surname, int? managerId, string ContactType, string bestContactMethod,
            string KnowAs, string JobRole, string OfficePhone, string MobilePhone, string STHomePhone,
            string EmailAddress, string Workbase, string JobTitle, string ContactIsActive="0")
        {
            if (firstname == "")
            {
                ViewBag.ErrorMessage = "Please input the contact name";
                return RedirectToAction("Add", "Contact");
            }
            if (surname == "")
            {
                ViewBag.ErrorMessage = "Please input the contact surname";
                return RedirectToAction("Add", "Contact");
            }
            if (ContactType == "")
            {
                ViewBag.ErrorMessage = "Please input the contact type";
                return RedirectToAction("Add", "Contact");
            }
            Contact contact = new Contact();

            contact.FirstName = firstname;
            contact.Surname = surname;
            contact.ManagerID = managerId;
            contact.ContactType = ContactType;
            contact.BestContactMethod = bestContactMethod;
            contact.KnownAs = KnowAs;
            contact.JobRole = JobRole;
            contact.OfficePhone = OfficePhone;
            contact.MobilePhone = MobilePhone;
            contact.STHomePhone = STHomePhone;
            contact.EmailAddress = EmailAddress;
            contact.Workbase = Workbase;
            contact.JobTitle = JobTitle;
            contact.ContactIsActive = ContactIsActive=="0"?0:1;

            db.Contacts.InsertOnSubmit(contact);
            db.SubmitChanges();

            ViewBag.TagName = TagName;
            ViewBag.TagId = TagId;

            ViewBag.Alert = "true";
            ViewBag.Message = "Action success!";
            ViewBag.URL = "/Contact/List?TagId=" + TagId + "&TagName=" + TagName;

            return View("../Shared/Redirect");
            //return Redirect("/Contact/List?TagId=" + TagId + "&TagName=" + TagName);
        }
 public void Insert(Contact newcont)
 {
     dataAccess.Contacts.InsertOnSubmit(newcont);
     dataAccess.SubmitChanges();
 }
 partial void DeleteContact(Contact instance);
 partial void UpdateContact(Contact instance);
 partial void InsertContact(Contact instance);
		private void detach_Contacts(Contact entity)
		{
			this.SendPropertyChanging();
			entity.Contact1 = null;
		}
		private void attach_Contacts(Contact entity)
		{
			this.SendPropertyChanging();
			entity.Contact1 = this;
		}