Exemplo n.º 1
0
        public ActionResult GetTimesByPerson(int id)
        {
            var person = PersonHandler.Select(id);
            var db     = BusinessLayer as DbTimeHandler;
            var times  = db.GetTimesByPeople(new List <PersonDTO>()
            {
                person
            });

            return(Json(times));
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
0
 public ActionResult GetHighScoreForPersonForDiscipline(int personId, int disciplineId)
 {
     try
     {
         var person     = PersonHandler.Select(personId);
         var discipline = DisciplineHandler.Select(disciplineId);
         var highscore  = ((DbTimeHandler)BusinessLayer).GetHighscoreForPersonForDiscipline(person, discipline);
         return(Json(highscore, JsonRequestBehavior.AllowGet));
     }
     catch (Exception e)
     {
         HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
         return(Json(e.Message, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 4
0
        protected override DbObjDTO GetDtoFromCollection(int id, FormCollection collection)
        {
            var time = new TimeDTO
            {
                Pk      = id,
                FK_D    = int.Parse(collection["FK_D"]),
                FK_P    = int.Parse(collection["FK_P"]),
                Date    = Convert.ToDateTime(collection["Date"]),
                Seconds = decimal.Parse(collection["Seconds"])
            };

            time.Person     = PersonHandler.Select(time.FK_P);
            time.Discipline = DisciplineHandler.Select(time.FK_D);

            return(time);
        }