public ActionResult Save(string team, string assignee, string date, string story, string task, string description, string commitment, string status) { try { var commitmentHandler = new CommitmentHandler(); var c = new Commitment { Team = team, Assignee = assignee, Date = date, Story = story, Task = task, Description = description, CommitmentAim = commitment, Status = status, }; commitmentHandler.SaveCommitment(c); return Json("Success", JsonRequestBehavior.AllowGet); } catch(Exception ex) { return Json("Error", JsonRequestBehavior.AllowGet); } }
public void SaveCommitment(Commitment commitment) { // Save to XML var f = openCommitmentsFile(); // Identify which member to modify var node = f.Descendants("Team") .Where(t => t.Attribute("name").Value == commitment.Team) .Descendants("Member") .Single(e => e.Attribute("Assignee").Value == commitment.Assignee); // modify specific zone combination node.Element("Date").Value = commitment.Date; node.Element("Story").Value = commitment.Story; node.Element("Task").Value = commitment.Task; node.Element("Description").Value = commitment.Description; node.Element("Commitment").Value = commitment.CommitmentAim; node.Element("Status").Value = commitment.Status; f.Save(FILE_NAME, SaveOptions.None); }