コード例 #1
0
        public ActionResult BindQrCode(Guid id)
        {
            ViewBag.QrGuid = id.ToString();
            var unassignedProfiles = new QrContext().QrProfiles.Where(p => p.QrCodeGuid == Guid.Empty).Select(p => new { FirstName = p.FirstName, MiddleName = p.MiddleName, LastName = p.LastName, Id = p.Id });

            return(View(unassignedProfiles));
        }
コード例 #2
0
        public ActionResult ViewProfile(Guid id)
        {
            ViewBag.Title = "Profile";
            var profile = new QrContext().QrProfiles.FirstOrDefault(p => p.QrCodeGuid == id);

            if (profile != null)
            {
                return(View(profile));
            }
            else
            {
                if (User.IsInRole("Admin"))
                {
                    return(new RedirectResult(String.Format("~/BindQrCode/{0}", id.ToString())));
                }
                else
                {
                    return(new RedirectResult(String.Format("~/Profiles/Create/{0}", id.ToString())));
                }
            }
        }