Ejemplo n.º 1
0
        [HttpPost]/*, ValidateAntiForgeryToken]*/
        public ActionResult AddContact(ContactModel model)
        {
            if (ModelState.IsValid && MainObject.CheckUserHasWriteAccess(model.MainId))
            {
                model.Save();

                return(PartialView("Partials/_contactList", ContactObject.GetContacts(model.MainId)));
            }

            return(null);
        }
Ejemplo n.º 2
0
        public ContactModel(ContactObject contact)
        {
            if (contact != null)
            {
                SortMainId  = contact.SortMainId;
                ContactId   = contact.ContactId;
                EmployeeId  = contact.EmployeeId;
                ContactType = contact.ContactType;

                Contacts = ContactObject.GetContacts(SortMainId);
            }
        }
Ejemplo n.º 3
0
        [HttpPost]/*, ValidateAntiForgeryToken]*/
        public ActionResult AddContact(ContactModel model)
        {
            if (ModelState.IsValid && SortMainObject.CheckUserHasWriteAccess(model.SortMainId))
            {
                model.Save();

                return(PartialView("Partials/_contactList", ContactObject.GetContacts(model.SortMainId)));
            }

            Response.StatusCode = (int)HttpStatusCode.BadRequest;
            return(null);
        }
Ejemplo n.º 4
0
        public ContactModel(int mainId, int?contactId)
        {
            MainId   = mainId;
            Contacts = ContactObject.GetContacts(mainId);

            if (contactId.HasValue)
            {
                var contact = ContactObject.GetContact(contactId.Value);
                if (contact != null)
                {
                    ContactId         = contact.ContactId;
                    ContactEmployeeId = contact.EmployeeId;
                }
            }
        }
Ejemplo n.º 5
0
        public ActionResult RemoveContact(int?id)
        {
            int mid = 0;

            if (id.HasValue)
            {
                var contact = ContactObject.GetContact(id.Value);
                if (contact != null)
                {
                    mid = contact.MainId;
                    if (MainObject.CheckUserHasWriteAccess(mid))
                    {
                        contact.Delete();
                    }
                }
            }

            return(PartialView("Partials/_contactList", ContactObject.GetContacts(mid)));
        }