Пример #1
0
        public ActionResult GetChartsForPerson(int id)
        {
            var factory = new ChartFactory();
            var person  = PersonHandler.Select(id);
            var db      = BusinessLayer as DbTimeHandler;
            var times   = db.GetTimesByPeople(new List <PersonDTO>()
            {
                person
            });
            var charts = factory.CreateChartDataModels_Person(times);

            return(Json(charts, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult GetChartsForPerson(int id)
        {
            try {
                var factory = new ChartFactory();
                var person  = _personHandler.Select(id);
                var times   = _timeHandler.GetTimesByPeople(new List <PersonDTO> {
                    person
                });
                var charts = factory.CreateChartDataModels_Person(times);

                return(Json(charts, JsonRequestBehavior.AllowGet));
            }
            catch (InvalidDataException e)
            {
                HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                return(Json("An unknown error occoured!", JsonRequestBehavior.AllowGet));
            }
        }