public ActionResult Edit(string id) { var dt = _userRep.GetUserById(id); List <mRole> roles = new List <mRole>(); foreach (var item in RoleManager.Roles.ToList()) { var role = new mRole(); role.Name = item.Name; if (UserManager.IsInRole(id, item.Name)) { role.IsInRole = true; } else { role.IsInRole = false; } roles.Add(role); } ViewBag.Roles = roles; if (dt == null) { return(View("Response", new ResponseViewModel() { Msg = "Bad Request!" })); } return(PartialView(dt)); }