public IActionResult Index()
        {
            ViewData["Name"] = HttpContext.Session.GetString("UName");
            ViewData["Type"] = HttpContext.Session.GetString("Type");
            UserContext           userContext = HttpContext.RequestServices.GetService(typeof(UserContext)) as UserContext;
            HackathonContext      context     = HttpContext.RequestServices.GetService(typeof(HackathonContext)) as HackathonContext;
            Hackathon_UserContext HuContext   = HttpContext.RequestServices.GetService(typeof(Hackathon_UserContext)) as Hackathon_UserContext;
            dynamic user           = null;
            var     UserHackathons = new List <Hackathon>();

            if (ViewData["Name"] != null)
            {
                user = userContext.GetUserByUserName(ViewData["Name"].ToString());
                var UserHackathonList = HuContext.GetUserHackathons(user);
                foreach (int i in UserHackathonList)
                {
                    UserHackathons.Add(context.GetByID(i));
                }
            }


            dynamic Model = new ExpandoObject();

            Model.UserHackathonList  = UserHackathons;
            Model.NextHackathons     = context.GetNextHackathons();
            Model.PreviousHackathons = context.GetPreviousHackathons();
            Model.CurrentHackathons  = context.GetCurrentHackathons();
            return(View(Model));
        }
Exemplo n.º 2
0
        //public IActionResult AddProblemStatements()


        public IActionResult Index(int hid)
        {
            ViewData["Name"] = HttpContext.Session.GetString("UName");
            ViewData["Type"] = HttpContext.Session.GetString("Type");
            TempData["id"]   = hid;
            HackathonContext        hackathonContext        = HttpContext.RequestServices.GetService(typeof(HackathonContext)) as HackathonContext;
            Hackathon               Selection               = hackathonContext.GetByID(hid);
            ProblemStatementContext problemStatementContext = HttpContext.RequestServices.GetService(typeof(ProblemStatementContext)) as ProblemStatementContext;
            var SelectionPS = problemStatementContext.GetProblemStatementsById(hid);

            dynamic JointModel = new ExpandoObject();

            JointModel.ProblemStatements = SelectionPS;
            JointModel.Hackathon         = Selection;
            return(View(JointModel));
        }