Example #1
0
        /// <summary>
        /// GET method which intialize the model for the new contact. Too will load the details of the conatct if PK Id > 0
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult CreateContact(int id = 0)
        {
            Contact model = new Contact();

            model.MasterDisplayAsId = 2; //as default
            ViewBag.DisplayAs       = new SelectList(common.GetAllDisplayFormats(), "Id", "DisplayAs");

            if (id > 0)
            {
                try
                {
                    model = contact.GetAllContacts(id).FirstOrDefault();
                }
                catch (Exception ex)
                {
                }
            }
            return(PartialView(model));
        }