Ejemplo n.º 1
0
        //
        // GET: /UserRole/Create
        public ActionResult Create()
        {
            UserRoleBAL userRoleBAL = new UserRoleBAL();
            var         model       = new UserRoleModel();

            return(View(model));
        }
Ejemplo n.º 2
0
        //
        // GET: /Users/Edit/5
        public ActionResult Edit(int id)
        {
            UserBAL _userBAL = new UserBAL();
            User    _user    = _userBAL.GetUserById(id);
            var     model    = new UserModel();

            model.Id        = _user.Id;
            model.UserName  = _user.UserName;
            model.Email     = _user.Email;
            model.Password  = _user.Password;
            model.IsActive  = true;
            model.LawFirmId = _user.LawFirmId;
            //model.PersonId = _user.PersonId;
            model.UpdatedDate = DateTime.Now.ToUniversalTime();
            model.IsDeleted   = false;
            //model.RewardPoints = _user.RewardPoints;
            model.RoleId      = _user.RoleId;
            model.CreatedDate = _user.CreatedDate;

            UserRoleBAL     _userRoleBAL = new UserRoleBAL();
            List <UserRole> userRole     = _userRoleBAL.GetAllUserRoles();

            foreach (var i in userRole)
            {
                model.Roles.Add(new SelectListItem
                {
                    Text  = i.RoleName,
                    Value = i.Id.ToString()
                });
            }

            return(View(model));
        }
Ejemplo n.º 3
0
        //
        // GET: /UserRole/Edit/5
        public ActionResult Edit(int id)
        {
            var      _userRoleBAL = new UserRoleBAL();
            UserRole userRole     = _userRoleBAL.GetUserRoleById(id);
            var      model        = new UserRoleModel();

            model.RoleId      = userRole.Id;
            model.RoleName    = userRole.RoleName;
            model.IsActive    = userRole.IsActive;
            model.CreatedBy   = "Admin";
            model.CreatedDate = DateTime.Now.ToUniversalTime();

            return(View(model));
        }
Ejemplo n.º 4
0
        //
        // GET: /UserRole/
        public ActionResult Index()
        {
            UserRoleBAL          _userRole      = new UserRoleBAL();
            List <UserRole>      user           = _userRole.GetAllUserRoles();
            List <UserRoleModel> _userRoleModel = new List <UserRoleModel>();

            foreach (var u in user)
            {
                var model = new UserRoleModel();
                model.RoleId      = u.Id;
                model.RoleName    = u.RoleName;
                model.IsActive    = u.IsActive;
                model.CreatedBy   = "Admin";
                model.CreatedDate = DateTime.Now.ToUniversalTime();
                _userRoleModel.Add(model);
            }
            return(View(_userRoleModel));
        }
Ejemplo n.º 5
0
        public ActionResult Edit(int id, UserRoleModel model)
        {
            try
            {
                UserRoleBAL _userRoleBAL = new UserRoleBAL();
                UserRole    _userRole    = _userRoleBAL.GetUserRoleById(id);
                _userRole.Id          = model.RoleId;
                _userRole.RoleName    = model.RoleName;
                _userRole.IsActive    = model.IsActive;
                _userRole.CreatedBy   = model.CreatedBy;
                _userRole.CreatedDate = model.CreatedDate;
                _userRoleBAL.UpdateUserRole(_userRole);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 6
0
        //
        // GET: /Users/Create
        public ActionResult Create()
        {
            var model = new UserModel();

            UserRoleBAL     _userRoleBAL = new UserRoleBAL();
            List <UserRole> userRole     = _userRoleBAL.GetAllUserRoles();

            foreach (var i in userRole)
            {
                model.Roles.Add(new SelectListItem
                {
                    Text  = i.RoleName,
                    Value = i.Id.ToString()
                });
            }

            //var user = new QuestionModel();

            return(View());
        }
Ejemplo n.º 7
0
        public ActionResult Create(UserRoleModel user)
        {
            try
            {
                UserRoleBAL _userRoleBAL = new UserRoleBAL();
                UserRole    _userRole    = new UserRole();
                _userRole.Id          = user.RoleId;
                _userRole.RoleName    = user.RoleName;
                _userRole.IsActive    = user.IsActive;
                _userRole.CreatedBy   = "Admin";
                _userRole.CreatedDate = DateTime.Now.ToUniversalTime();


                _userRoleBAL.AddUserRole(_userRole);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }