예제 #1
0
        public async Task<ActionResult> PagerDutyIncidentDetail(int id)
        {
            var incident = PagerDutyApi.Instance.Incidents.Data.First(i => i.Number == id);
            var vd = new PagerDutyIncidentModel
            {
                Incident = incident,
                Logs = await incident.Logs
            };

            return View("PagerDuty.Incident", vd);
        }
        public ActionResult PagerDutyActionIncident(string apiAction, string incident)
        {
            var pdUser = CurrentPagerDutyPerson;
            if (pdUser == null) return ContentNotFound("PagerDuty Persoon Not Found for " + Current.User.AccountName);

            var activeIncident = new PagerDutyEditIncident
            {
                Id = incident,
                Status = apiAction
            };
            var data = new PagerDutyIncidentModel
            {
                Incidents = new List<PagerDutyEditIncident> { activeIncident },
                RequesterId = pdUser.Id
            };
            PagerDutyApi.Instance.GetFromPagerDuty("incidents",
                getFromJson: response => response.ToString(), httpMethod: "PUT", data: data);

            PagerDutyApi.Instance.Incidents.Poll(true);

            return Json(true);
        }