Exemplo n.º 1
0
        public async Task <ActionResult> Edit(string id, List <string> errors = null)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //get account info
            var user = await UserManager.FindByNameAsync(id);

            //get user info
            var userInfo = await _userBus.GetById(id);

            if (user == null)
            {
                return(HttpNotFound());
            }

            var userRoles = await UserManager.GetRolesAsync(user.Id);

            ViewBag.RoleId = new SelectList(await RoleManager.Roles.ToListAsync(), "Name", "Name");
            ViewBag.Errors = errors;
            return(View(new EditUserAccountViewModel()
            {
                Id = user.Id,
                Company = userInfo.Company,
                CountExperience = userInfo.CountExperience,
                CurrentJob = userInfo.CurrentJob,
                Email = user.Email,
                FullName = userInfo.FullName,
                TimeUnit = userInfo.TimeUnit,
                Username = user.UserName,

                RolesList = userRoles
            }));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> AddWatcher(string username)
        {
            try
            {
                var result = await _userInfoBUS.GetById(username);

                return(View(result));
            }
            catch
            {
                return(Content("0"));
            }
        }
Exemplo n.º 3
0
        public async Task <ActionResult> AddMember(string username, int roleId)
        {
            try
            {
                var result = await _userInforBus.GetById(username);

                ViewBag.JobRole = await _jobRoleBUS.GetById(roleId);

                return(View(result));
            }
            catch
            {
                return(Content("0"));
            }
        }