How to replace XML string into another XML string

<recurrence> <interval>1</interval> <unit>O</unit> <firsttime>2021-02-12T17:42:00</firsttime> <lasttime>1900-01-01T12:00:00</lasttime> </recurrence> <output> <outputformat>TXT</outputformat> <delimiter>,</delimiter> <filename>testfile1</filename> <path>\AIR-LAP-700053TestGEMOutput</path> <appendtofile /> <content> <type>NORMAL</type> <storedprocedure /> <outputitems> <outputitem> <field> <tablename>VW_DOCUMENT</tablename> <fieldname>GUID</fieldname> </field> <format> <type>CHAR</type> <specification /> </format> </outputitem> <outputitem> <field> <tablename>VW_DOCUMENT</tablename> <fieldname>PHYSICAL_DOC_GUID</fieldname> </field> <format> <type>CHAR</type> <specification /> </format> </outputitem> <outputitem> <field> <tablename>VW_DOCUMENT</tablename> <fieldname>DOC_TYPE</fieldname> </field> <format> <type>CHAR</type> <specification /> </format> </outputitem> </outputitems> <criteria> <criterion> <field> … Read more

Able to access Database without opening connection, using Dapper

So I have the following piece of code that is showing a strange behavior or I am missing some point here: public async Task<IEnumerable<MyData>> GetMyData() { MySqlConnection conn; IEnumerable<MyData> list; string querystring = "SELECT * FROM tbl_mydata;"; using (conn = new MySqlConnection(mydbconnectionString)) { //conn.Open(); ConnectionState check1 = conn.State; list = await conn.QueryAsync<MyData>(querystring, commandType: CommandType.Text); ConnectionState … Read more

Redirect back to Previous Page without losing original data

I have trouble preserving the original data by redirecting the same page when my custom error handling is executed in the controller.
Assume that I have a web page call Create.cshtml.
In that create webpage, I have a few form control which require the user to enter class code but the class code cannot be duplicated.
Assume that the user entered a class code that is existed in the system, my system should redirect back to Create.cshtml and pass error message (E.g. ViewBag.error = “Class Code duplicated”) and simulatenously .
But my current implementation does not revert back the original content/data after redirect.