示例#1
0
        public ActionResult CreateXmlContact(XmlContact XMLGrid, int ParentID, string ReturnUrl)
        {

            List<XmlContact> l = new List<XmlContact>();
            Uco.Models.PageLocation p = _db.PageLocations.FirstOrDefault(r => r.ID == ParentID);
            if (p != null) l = p.GetContactsFromXML<XmlContact>();

            if (l.Count != 0)
            {
                XMLGrid.ID = l.Max(r => r.ID) + 1;
                XMLGrid.Order = l.Max(r => r.Order) + 1;
            }
            else
            {
                XMLGrid.ID = 1;
                XMLGrid.Order = 1;
            }
            l.Add(XMLGrid);

            p.SetContactsToXML<XmlContact>(l);
            _db.Entry(p).State = EntityState.Modified;
            _db.SaveChanges();
            //ViewBag.ReturnUrl = Url.Content("/Admin/Main/Edit/" + ParentID);
            return Redirect(Url.Content("/Admin/Main/Edit/" + ParentID));
        }
示例#2
0
        public ActionResult EditXmlContact(int ParentID, int ID, string ReturnUrl)
        {
            ViewBag.ParentID = ParentID;
            ViewBag.ReturnUrl = ReturnUrl;

            List<XmlContact> l = new List<XmlContact>();
            Uco.Models.PageLocation p = _db.PageLocations.FirstOrDefault(r => r.ID == ParentID);
            if (p != null) l = p.GetContactsFromXML<XmlContact>();

            XmlContact current_xml = l.Where(r => r.ID == ID).FirstOrDefault();
            return View("EditXMLContact", "", current_xml);
        }
示例#3
0
 public ActionResult EditXmlContact(XmlContact curent_xml, int ParentID, string ReturnUrl)
 {
     List<XmlContact> l = new List<XmlContact>();
     Uco.Models.PageLocation p = _db.PageLocations.FirstOrDefault(r => r.ID == ParentID);
     if (p != null) l = p.GetContactsFromXML<XmlContact>();
     l.RemoveAll(r => r.ID == curent_xml.ID);
     l.Add(curent_xml);
     p.SetContactsToXML<XmlContact>(l);
     _db.Entry(p).State = EntityState.Modified;
     _db.SaveChanges();
     //ViewBag.ReturnUrl = Url.Content("/Admin/Main/Edit/" + ParentID);
     return Redirect(Url.Content("/Admin/Main/Edit/" + ParentID));
 }
示例#4
0
        public ActionResult DeleteXmlContact(int ID, int ParentID, string ReturnUrl)
        {
            List<XmlContact> l = new List<XmlContact>();
            Uco.Models.PageLocation p = _db.PageLocations.FirstOrDefault(r => r.ID == ParentID);
            if (p != null) l = p.GetContactsFromXML<XmlContact>();

            l.RemoveAll(r => r.ID == ID);

            p.SetContactsToXML<XmlContact>(l);
            _db.Entry(p).State = EntityState.Modified;
            _db.SaveChanges();

            return Redirect(Url.Content("/Admin/Main/Edit/" + ParentID + "#TabStrip-6"));
        }
示例#5
0
        public ActionResult _XmlContacts_AjaxIndex([DataSourceRequest]DataSourceRequest request, int ParentID)
        {
            List<XmlContact> l = new List<XmlContact>();
            Uco.Models.PageLocation p = _db.PageLocations.FirstOrDefault(r => r.ID == ParentID);
            try
            {
                if (p != null) l = p.GetContactsFromXML<XmlContact>();
            }
            catch { }

            DataSourceResult result = l.OrderBy(r => r.Order).ToDataSourceResult(request);

            return Json(result);

        }