コード例 #1
0
        public ActionResult Detail(int id)
        {
            var gpMapper = new GpMapper();
            Gp  gp       = gpMapper.SelectGp(id);

            gp.State     = States.FindForGp(gp);
            ViewBag.Name = gp.Name;

            gpMapper.GetPrevNextDriver(id, out int?prev, out int?next);
            ViewBag.Prev = prev;
            ViewBag.Next = next;

            ViewBag.IfGp = User.Identity.IsAuthenticated && ButtonEnable.GpEdit(gp.UserId, new UsersMapper().SelectUser(User.Identity.Name));

            return(View(gp));
        }
コード例 #2
0
        public ActionResult Classifications(int id)
        {
            var gpMapper = new GpMapper();
            var gp       = gpMapper.SelectGp(id);

            ViewBag.Name = gp.Name;

            gpMapper.GetPrevNextDriver(id, out int?prev, out int?next);
            ViewBag.Prev = prev;
            ViewBag.Next = next;
            ViewBag.Id   = id;

            Dictionary <int, Classification> classifications = new ClassificationMapper().SelectAll(id);

            ViewBag.IfGp = User.Identity.IsAuthenticated && ButtonEnable.GpEdit(gp.UserId, new UsersMapper().SelectUser(User.Identity.Name));

            return(View(classifications));
        }
コード例 #3
0
        public ActionResult ClassificationsEdit(int id)
        {
            GpMapper gpMapper = new GpMapper();
            Gp       gp       = gpMapper.SelectGp(id);

            if (!(User.IsInRole("Admin") || ButtonEnable.GpEdit(gp.UserId, new UsersMapper().SelectUser(User.Identity.Name))))
            {
                return(RedirectToAction("Classifications", "Gp", new { id = id }));
            }

            gp.State = States.FindForGp(gp);

            ViewBag.Name = gp.Name;
            ViewBag.Id   = id;

            ViewBag.Points = new PointsMapper().SelectAll();

            ViewBag.Classifications = new ClassificationMapper().SelectAll(id);

            return(View(new DriversMapper().SelectAll()));
        }