Nabil Nawaz

Nabil Nawaz

  • NA
  • 200
  • 31.1k

Update Xml Record In Database Asp Net Mvc

Jul 23 2017 4:07 PM
Hello guys !
i've a scenario in asp net mvc with entity framework where when user enter a record i save it in one field in XML form after converting whole object into XML.
 
now i'm not able to update it. like when user updates the record i want previous XML to be there and new updated XML come into that column following the previous XML in that column
 
like
 
this is when user submits a new record the XML is saved like this

<?xml version="1.0" encoding="utf-16"?>
<UserRightsXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
<Id_Num>0</Id_Num>
<RecordId>45</RecordId>
<User_Reg_02_Id_Num>17</User_Reg_02_Id_Num>
<Cr_Id>30</Cr_Id>
<Cr_Date>2017-07-23T16:32:23.0543196+05:00</Cr_Date>
<Cr_Log>[email protected] / MESSI / MESSI-PC / 192.168.1.4 / C4544458517B</Cr_Log>
<Up_Id xsi:nil="true" />
<Up_Date xsi:nil="true" />
 
</UserRightsXml>
 
now when user updates this record i want data to be saved like this

<?xml version="1.0" encoding="utf-16"?>
<UserRightsXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
<Id_Num>0</Id_Num>
<RecordId>45</RecordId>
<User_Reg_02_Id_Num>17</User_Reg_02_Id_Num>
<Cr_Id>30</Cr_Id>
<Cr_Date>2017-07-23T16:32:23.0543196+05:00</Cr_Date>
<Cr_Log>[email protected] / MESSI / MESSI-PC / 192.168.1.4 / C4544458517B</Cr_Log>
<Up_Id xsi:nil="true" />
<Up_Date xsi:nil="true" />
 
<Id_Num>0</Id_Num>
<RecordId>45</RecordId>
<User_Reg_02_Id_Num>18</User_Reg_02_Id_Num>
<Cr_Id>30</Cr_Id>
<Cr_Date>2017-07-23T16:32:23.0543196+05:00</Cr_Date>
<Cr_Log>[email protected] / MESSI / MESSI-PC / 192.168.1.4 / C4544458517B</Cr_Log>
<Up_Id xsi:nil="true" />
<Up_Date xsi:nil="true" />
 
</UserRightsXml>
 
and so on whenever record gets updated

Answers (1)