public ActionResult GetUserDetails(int userid, int orgid) { var mgr = new AdminMembersRepository(); var list = mgr.GetUserDetails(userid); var permission = mgr.GetPermission(userid, orgid); var requiredItems = mgr.GetRequiredItems(userid, orgid); var extraItems = mgr.GetExtraItems(userid, orgid); var result = new { Id = list.Id, FullName = list.FullName, Email = list.Email, PhoneNumber = list.PhoneNumber, Permission = permission, RequiredItems = requiredItems.OrderBy(i => i.ExpirationDate).Select(e => new { Id = e.Id, Name = e.Name, ExpirationDate = e.ExpirationDate.ToShortDateString(), CategoryName = e.Category.Name }), ExtraItems = extraItems.OrderBy(i => i.ExpirationDate).Select(e => new { Id = e.Id, Name = e.Name, ExpirationDate = e.ExpirationDate.ToShortDateString(), CategoryName = e.Category.Name }), Courses = list.Courses.Select(e => new { Id = e.Id, Name = e.Name, Date = e.Date.ToShortDateString(), Credits = e.Credits }), CoreCourses = list.CoreCourses.Select(e => new { Id = e.Id, Name = e.Name, Date = e.Date.ToShortDateString(), CategoryName = e.CourseCategory.Name }) }; return(Json(result, JsonRequestBehavior.AllowGet)); }