Exemplo n.º 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));
        }
Exemplo n.º 2
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));
 }
Exemplo n.º 3
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"));
        }