Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

Update data into xml file using wcf rest service?

$
0
0
IService:

[ServiceContract]
    public interface IService1
    {
        [OperationContract]
        void InsertData(Student st);
        
        [OperationContract]
        void UpdateData(Student su);
    }


Service.cs:


public void InsertData(Student st)
        {

            XDocument doc = XDocument.Load(HttpContext.Current.Server.MapPath("StudentDB.xml"));
            doc.Element("Students").Add(
                new XElement("student",
                    new XAttribute("name", st.name),
                    new XAttribute("number", st.number)
 );

            doc.Save(HttpContext.Current.Server.MapPath("StudentDB.xml")); 
        }

 public void UpdateData(Student su)
        {
           
            XDocument doc = XDocument.Load(HttpContext.Current.Server.MapPath("StudentDB.xml"));
            var up=doc.
        }

How can i update data into xml?

anilbabu


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>