Q:

Match and select XML element and replace value of sibling element

I have an XML doc (see extract below), and I have a method to which I pass in 3 string arguments - a user name, file name and status. I need the program to look over the XML document, match the file name to a DMC element of the file, then change the status and currentUser element values to the userName and status values that I passed into my method. 
<dataModule>
    <DMC>DMC-PO-A-49-00-00-00A-012A-C_001.SGM</DMC>
    <techName>Pneumatic and shaft power gas turbine engine</techName>
    <infoName>General warnings and cautions and related safety data</infoName>
    <status>Checked In</status>
    <notes>-</notes>
    <currentUser>-</currentUser>
</dataModule>
<dataModule>
    <DMC>DMC-PO-A-49-00-00-00A-00VA-C_001.SGM</DMC>
    <techName>Pneumatic and shaft power gas turbine engine</techName>
    <infoName>List of Applicable Specifications and Documentation</infoName>
    <status>Checked In</status>
    <notes>-</notes>
    <currentUser>-</currentUser>
</dataModule>
<dataModule>
    <DMC>DMC-PO-A-49-00-00-00A-001A-C_001.SGM</DMC>
    <techName>Pneumatic and shaft power gas turbine engine</techName>
    <infoName>Title page</infoName>
    <status>Checked In</status>
    <notes>-</notes>
    <currentUser>-</currentUser>
</dataModule>

Currently I have the following code. I hope this makes it clear what I'm trying to achieve. It's a WinForms project and I'd like to do this using Linq.
public static void updateStatus(string user, string file, string status)
{
    XDocument doc = XDocument.Load(Form1.CSDBpath + Form1.projectName + "\\Data.xml");

    var el = from item in doc.Descendants("dataModule")
             where item.Descendants("DMC").First().Value == file
             select item;

    var stat = el.Descendants("status");

    // code here to change the value of the 'status' element text

    var newUser = el.Descendants("currentUser");

    // code here to change the value of the 'currentUser' element text

}

A:

You may have been tripped up by the fact that your Linq query is returning an IEnumerable<XElement> and not a single XElement.  Here's one way you could accomplish what you want to:
public static void updateStatus(string user, string file, string status)
{
    XDocument doc = XDocument.Load(@"C:\Projects\ConsoleApp\XMLDocument.xml");

    var els = from item in doc.Descendants("dataModule")
              where item.Descendants("DMC").First().Value == file
              select item;

    if (els.Count() > 0)
    {
        XElement el = els.First();
        el.SetElementValue("status", status);
        el.SetElementValue("currentUser", user);

        doc.Save(@"C:\Projects\ConsoleApp\XMLDocument.xml");
    }
}

