public ActionResult Index() { MemberViewModel vm = new MemberViewModel(); var mgr = new AdminMembersRepository(); vm.Organization = mgr.GetOrganizationByUser(int.Parse(User.Identity.Name)); vm.Members = mgr.GetAllMembers(vm.Organization.Id); vm.UserOrganizations = mgr.UserOrgItems(vm.Organization.Id); vm.Required = mgr.GetRequiredItems(int.Parse(User.Identity.Name)); //vm.Organization = mgr.GetOrganizationByUser(int.Parse(User.Identity.Name)); return(View(vm)); }
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)); }