public virtual ActionResult GetUserRoles(long userId)
        {
            try
            {
                var data = _personManagementService.GetUserRoles(userId).Item3;

                JArray ja = new JArray();

                foreach (var item in data)
                {
                    var itemObject = new JObject
                    {
                        { "UserId", item.UserId },
                        { "RoleId", item.RoleId },
                        { "RoleName", item.RoleName },
                        { "RoleNameFa", item.RoleNameFa }
                    };
                    ja.Add(itemObject);
                }
                JObject jo = new JObject {
                    { "total", data.ToList().Count }, { "rows", ja }
                };
                return(Content(JsonConvert.SerializeObject(jo)));
            }
            catch (Exception ex)
            {
                return(Json(new { isError = true, Msg = "خطا در لود اطلاعات پرسنل" }));
            }
        }
Beispiel #2
0
 public override string[] GetRolesForUser(string username)
 {
     return(_personManagementService.GetUserRoles(username));
 }