Example #1
0
        public JsonResult GetContests()
        {
            var Directory = System.IO.Directory.GetCurrentDirectory();

            var contests = contestRepo.GetAllContests();

            return(Json(contests, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public IEnumerable <ContestBO> GetAllContests()
        {
            using (var context = new aspnet_learningEntities())
            {
                var repository = new ContestRepository(context);
                var contests   = repository.GetAllContests();

                return(contests.Select(c => new ContestBO(
                                           c.id,
                                           c.name,
                                           c.food_item,
                                           c.location,
                                           c.date ?? new DateTime(),
                                           c.contest_participations.ToList().Count)));
            }
        }