Пример #1
0
        public JsonResult getUserDetails(string username)
        {
            var    u      = _utils.getUserFromUserNameAsync(username).Result;
            string role   = _utils.GetRolesAsync(u).Result;
            string exep   = "";
            string imgUrl = u.UserPic == null?"":_utils.download(u.UserPic, out exep);

            if (!string.IsNullOrEmpty(exep))
            {
                imgUrl = "";
            }
            StudentSlab s  = new StudentSlab();
            Staff       st = new Staff();

            if (role == "Student")
            {
                s = _utils.getStudentFromUserAsync(u).Result;
            }
            if (role == "Staff" || role == "Teacher")
            {
                st = _utils.getStaffFromUserAsync(u).Result;
            }
            return(Json(new { user = u, role = role, student = s, staff = st, imgUrl = imgUrl }));
        }