Ejemplo n.º 1
0
        public ActionResult EditPublisher(int?publisherId, bool success = false)
        {
            if (!User.IsInRole("Admin"))
            {
                return(RedirectToAction("Error"
                                        , new
                {
                    errorCode = "Lỗi 403."
                    ,
                    errorDetail = "Bạn không có quyền truy cập"
                }));
            }

            if (publisherId == null)
            {
                return(RedirectToAction("Error"
                                        , new
                {
                    errorCode = "Lỗi 404."
                    ,
                    errorDetail = "Không xác định nhà sản xuất / nhà xuất bản"
                }));
            }
            ViewBag.IsAdmin = true;
            ViewBag.User    = db.Users.Where(u => u.Username == User.Identity.Name).FirstOrDefault();
            return(View(PublisherVM.GeneratePublisherVM(db, publisherId, success)));
        }
Ejemplo n.º 2
0
        public ActionResult AddPublisher(bool success = false)
        {
            if (!User.IsInRole("Admin"))
            {
                return(RedirectToAction("Error"
                                        , new
                {
                    errorCode = "Lỗi 403."
                    ,
                    errorDetail = "Bạn không có quyền truy cập"
                }));
            }
            ViewBag.IsAdmin = true;

            ViewBag.User = db.Users.Where(u => u.Username == User.Identity.Name).FirstOrDefault();
            return(View(PublisherVM.GeneratePublisherVM(db, success)));
        }