/// <summary>
 /// Gets the Alerts and returns the Alerts view.
 /// </summary>
 /// <param name="mediaServer"></param>
 /// <returns></returns>
 public ActionResult Alert(string mediaServer)
 {
     Trace.WriteLine("Entering Alert method");
     try
     {
         ViewBag.DateSortParm = "date_desc";
         IEnumerable <Alert> alerts = DocumentDBDataController.GetAlerts(mediaServer);
         ViewBag.Mediaserver = mediaServer;
         ViewBag.Alerts      = alerts;
         if (ViewBag.Name == null)
         {
             ViewBag.Name = "Name";
         }
         if (ViewBag.Severity == null)
         {
             ViewBag.Severity = "Severity";
         }
         if (ViewBag.Category == null)
         {
             ViewBag.Category = "Category";
         }
         var mediaServer1 = DocumentDBDataController.GetMediaServers();
         return(View(alerts));
     }
     catch (Exception ex)
     {
         Trace.TraceError("Error:" + ex.Message);
         return(View("Error"));
     }
 }
        /// <summary>
        /// Gets the Alerts in ascending or decending order and returns Alert partial view.
        /// </summary>
        /// <param name="sortOrder"></param>
        /// <param name="media"></param>
        /// <returns></returns>
        public ActionResult GetSortedDate(string sortOrder, string media)
        {
            Trace.WriteLine("Entering GetSortedDate method");
            ViewBag.DateSortParm = sortOrder == "Date" ? "date_desc" : "Date";
            switch (sortOrder)
            {
            case "Date":
                IEnumerable <Alert> alerts1 = DocumentDBDataController.GetAlerts(media);
                ViewBag.Mediaserver = media;
                ViewBag.Alerts      = alerts1;
                return(PartialView("Alert", alerts1));

            case "date_desc":
                List <Alert> alerts2 = DocumentDBDataController.GetAlertsInDescOrder(media);
                ViewBag.Mediaserver = media;
                ViewBag.Alerts      = alerts2;
                return(PartialView("Alert", alerts2));

            default:
                List <Alert> alerts = DocumentDBDataController.GetAlertsInDescOrder(media);
                ViewBag.Mediaserver = media;
                ViewBag.Alerts      = alerts;
                return(PartialView("Alert", alerts));
            }
        }
 /// <summary>
 /// Gets the  Alerts and returns the AlertSingle view.
 /// </summary>
 /// <param name="mediaServer"></param>
 /// <param name="Id"></param>
 /// <returns></returns>
 public ActionResult AlertSingle(string mediaServer, string Id)
 {
     Trace.WriteLine("Entering AlertSingle method");
     try
     {
         IEnumerable <Alert> alerts = DocumentDBDataController.GetAlerts(mediaServer);
         ViewBag.Mediaserver = mediaServer;
         ViewBag.Alerts      = alerts;
         ViewBag.Id          = Id;
         return(View(alerts));
     }
     catch (Exception ex)
     {
         Trace.TraceError("Error:" + ex.Message);
         return(View("Error"));
     }
 }
        /// <summary>
        ///  Gets the Alerts by severity and returns the the Alert partial view.
        /// </summary>
        /// <param name="Severity"></param>
        /// <param name="media"></param>
        /// <param name="alerts"></param>
        /// <returns></returns>
        public ActionResult GetSeverity(string Severity, string media, IEnumerable <Alert> alerts)
        {
            Trace.WriteLine("Entering GetSeverity method");
            ModelState.Clear();
            ViewBag.Name     = "Name";
            ViewBag.Category = "Category";
            if (Severity.Equals("All"))
            {
                IEnumerable <Alert> alerts2 = DocumentDBDataController.GetAlerts(media);
                ViewBag.Mediaserver = media;
                ViewBag.Severity    = "All";
                return(PartialView("Alert", alerts2));
            }
            ViewBag.Severity = Severity;
            var alerts1 = DocumentDBDataController.GetAlertsBySeverity(Severity, media);

            ViewBag.Mediaserver = media;
            return(PartialView("Alert", alerts1));
        }
        /// <summary>
        /// Gets the Alerts by name and returns the the Alert partial view.
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="media"></param>
        /// <param name="alerts"></param>
        /// <returns></returns>
        public ActionResult GetAlertName(string Name, string media, IEnumerable <Alert> alerts)
        {
            Trace.WriteLine("Entering GetAlertName method");
            ModelState.Remove("Name");
            ViewBag.Severity = "Severity";
            ViewBag.Category = "Category";
            if (Name.Equals("All"))
            {
                IEnumerable <Alert> alerts2 = DocumentDBDataController.GetAlerts(media);
                ViewBag.Mediaserver = media;
                ViewBag.Name        = "All";
                return(PartialView("Alert", alerts2));
            }
            var alerts1 = DocumentDBDataController.GetAlertsByName(Name, media);

            ViewBag.Mediaserver = media;
            ViewBag.Name        = Name;
            return(PartialView("Alert", alerts1));
        }