Exemple #1
0
        public ActionResult List(int from = 1, int?to = null)
        {
            return(Json(
                       new
            {
                problems = _problemRepository.GetLatestProblems(from, to ?? 20)
                           .Select(c =>
                {
                    var shortDescription = c.Problem?.ShortDescription;
                    shortDescription = shortDescription?.Substring(0, Math.Min(50, shortDescription.Length));

                    return new
                    {
                        module = c.Problem?.Application?.Name,
                        id = c.Problem?.Id,
                        status = c.Problem?.Status?.ToString(),
                        shortDescription = shortDescription,
                        lastOccurence = c.Timestamp.ToString("dd.MM.yyyy HH:mm")
                    };
                }).ToArray()
            }, JsonRequestBehavior.AllowGet));
        }