Пример #1
0
        public ActionResult ManageContact(Contact contact)
        {
            contact.UserID = ProjectSession.UserID;
            var contactID = _contactBL.SaveContact(contact);

            if (contactID > 0)
            {
                if (!string.IsNullOrEmpty(contact.MobileNo))
                {
                    var contactMobile = new ContactMobile();
                    contactMobile.ContactID = contactID;
                    contactMobile.MobileNo  = contact.MobileNo;
                    _contactBL.SaveContactMobile(contactMobile);
                }

                if (!string.IsNullOrEmpty(contact.EmailAddress))
                {
                    var contactEmail = new ContactEmail();
                    contactEmail.ContactID    = contactID;
                    contactEmail.EmailAddress = contact.EmailAddress;
                    _contactBL.SaveContactEmail(contactEmail);
                }
                if (contact.ID == 0)
                {
                    return(RedirectToAction("manage-contact", new { id = contactID }));
                }
                else
                {
                    return(RedirectToAction("index"));
                }
            }
            return(View("ManageContact", contact));
        }