public ActionResult EditCalenderXml(FormCollection form, CalendarViewModel objcal)
        {
            if (!HasAdminPrivilege())
            {
                return RedirectToAction("Logon", "Account", new { ReturnUrl = Request.Url.PathAndQuery });
            }
            XDocument xmldoc = XDocument.Load(Server.MapPath("~/Meetings.xml"));
            //XElement xElement = xmldoc.XPathSelectElement("Meetings/Meeting/id[@id = '" + objcal.CalandarId + "']");

            var items = from item in xmldoc.Descendants("Meeting")
                        where item.Element("id").Value == objcal.CalandarId
                        select item;

            foreach (XElement itemElement in items)
            {
                string onlyDate = objcal.MeetingDate.Month + "/" + objcal.MeetingDate.Day + "/" + objcal.MeetingDate.Year;

                itemElement.SetElementValue("id", objcal.CalandarId);
                itemElement.SetElementValue("Title", objcal.Title);
                itemElement.SetElementValue("MeetingDate", onlyDate);
                itemElement.SetElementValue("StartTime", objcal.StartTime);
                itemElement.SetElementValue("EndTime", objcal.EndTime);
                itemElement.SetElementValue("Location", objcal.Location);
            }

            xmldoc.Save(Server.MapPath("~/Meetings.xml"));

            return View("calendarAdmin");
        }
        public ActionResult AddNewCalendarEvent(CalendarViewModel model)
        {
            XDocument xmlDoc = XDocument.Load(Server.MapPath("~/Meetings.xml"));

            if (model.CalandarId != null)
            {
                string onlyDate = model.MeetingDate.Month + "/" + model.MeetingDate.Day + "/" + model.MeetingDate.Year;
                xmlDoc.Element("Meetings").Add(new XElement("Meeting",
                new XElement("id", model.CalandarId),
                                                 new XElement("Title", model.Title),
                                                 new XElement("MeetingDate", onlyDate),
                                                 new XElement("StartTime", model.StartTime),
                                                 new XElement("EndTime",  model.EndTime),
                                                 new XElement("Location", model.Location)));

                xmlDoc.Save(Server.MapPath("~/Meetings.xml"));
            }

            return View();
        }