Exemplo n.º 1
0
        public ActionResult Edit(int id, UserViewModel collection)
        {
            var _user = ProcessUser.GetAllUsers(id);

            _user._Category = ProcessUser.GetCategory();
            _user._Roles    = ProcessUser.GetRoles();
            try
            {
                // TODO: Add update logic here
                var status = ProcessUser.EditUser(id, collection);
                if (status == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.ErrorMessage = "An Error Occurred";
                    return(View(_user));
                }
            }
            catch
            {
                return(View(_user));
            }
        }
Exemplo n.º 2
0
        public ActionResult Create(UserViewModel collection)
        {
            UserViewModel item = new UserViewModel();

            item._Roles    = ProcessUser.GetRoles();
            item._Category = ProcessUser.GetCategory();
            try
            {
                var status = ProcessUser.CreateUser(collection);
                if (status == "success")
                {
                    return(RedirectToAction("Index"));
                }
                if (status == "exist")
                {
                    ViewBag.ErrorMessage = "User Already Exist";
                    return(View(item));
                }
                else if (status == "error")
                {
                    ViewBag.ErrorMessage = "An Error Occurred during Creation";
                    return(View(item));
                }
                else
                {
                    ViewBag.ErrorMessage = "Invalid Username";
                    return(View(item));
                }
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 3
0
        // GET: User/Edit/5
        public ActionResult Edit(int id)
        {
            var _user = ProcessUser.GetAllUsers(id);

            _user._Category = ProcessUser.GetCategory();
            _user._Roles    = ProcessUser.GetRoles();
            return(View(_user));
        }
Exemplo n.º 4
0
        // GET: User/Create
        public ActionResult Create()
        {
            UserViewModel item = new UserViewModel();

            item._Roles    = ProcessUser.GetRoles();
            item._Category = ProcessUser.GetCategory();
            ViewBag.Users  = Common.GetUsersInProcurement();
            return(View(item));
        }