Пример #1
0
        public ActionResult Index()
        {
            if (TempData["status"] != null)
            {
                ViewBag.status = TempData["status"];
                ViewBag.msg    = TempData["msg"];
                TempData.Clear();
            }
            UserViewModel user   = Session["User"] as UserViewModel;
            IActivityDAL  dalAct = new ActivityImpl();

            if (user.assistance != null)
            {
                ActivitieAssistanceViewModel aa = ActivitieAssistanceViewModel.Converter(dalAct.GetCurrentActivity(user.assistance.idAssistance));
                if (aa != null)
                {
                    return(RedirectToAction("ActiveActivity", new { id = aa.idActivity }));
                }
            }
            List <Activity>          actvs      = dalAct.GetActivities();
            List <ActivityViewModel> activities = ActivityViewModel.Converter(actvs);
            string baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + "/";

            foreach (var actv in activities)
            {
                actv.qrCode = dalAct.PlaceQRInActivity(baseUrl, actv.idActivity);
            }
            return(View(activities));
        }