Ejemplo n.º 1
0
        public JsonResult GetCups()
        {
            dynamic cupsTable = new CupTotals();
            var cups = cupsTable.All(OrderBy: "name");

            var jsonWriter = new JsonFx.Json.JsonWriter();
            string jsonFX = jsonWriter.Write(cups);

            return Json(jsonFX, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 2
0
        public EmptyResult AddTotal(string id)
        {
            dynamic totals = new CupTotals();
            var person = totals.Single(where: "id=@0", args: id);

            person.total ++;

            totals.Update(person, person.id);

            return new EmptyResult();
        }
Ejemplo n.º 3
0
        public JsonResult GetTotals()
        {
            dynamic cupsTable = new CupTotals();
             var wins = cupsTable.Sum(columns: "wins");
             var total = cupsTable.Sum(columns: "total");

             var result = new
             {
                 wins = wins,
                 total = total
             };

             return Json(result, JsonRequestBehavior.AllowGet);
        }