示例#1
0
        public ActionResult Edit()
        {
            if (!CheckLogin())
            {
                return(RedirectToAction("Login", "User"));
            }

            string userName = Session[DSEConstant.UserName].ToString();

            if (!string.IsNullOrEmpty(userName))
            {
                if (Session[DSEConstant.UserName].ToString().Equals(userName))
                {
                    try
                    {
                        User user = new User();
                        user            = _userFactory.GetUser(userName);
                        ViewBag.Roles   = _roleFactory.GetSelectListRole();
                        ViewBag.Clients = _clientFactory.GetSelectListClient();
                        return(View(user));
                    }
                    catch (Exception e)
                    {
                        log.Error(string.Format("{0} at {1} \n {2} ", e.Message, DateTime.Now, e.Source));
                        return(RedirectToAction("Index", "Home"));
                    }
                }
                else
                {
                    return(RedirectToAction("Index", "Error", new { id = 502 }));
                }
            }

            return(RedirectToAction("Index", "Home"));
        }
示例#2
0
        public ActionResult Create()
        {
            if (!CheckLogin())
            {
                return(RedirectToAction("Login", "User"));
            }
            if (!CheckRole(ERole.Create))
            {
                return(RedirectToAction("Index"));
            }

            ViewBag.Roles   = _roleFactory.GetSelectListRole();
            ViewBag.Clients = _clientFactory.GetSelectListClient();
            return(View());
        }