internal List<GetGroupModel> GetGroup(GroupEntity objReq) { using (var db = new WizzDataContext()) { //List<GetGroupModel> groupList = new List<GetGroupModel>(); List<GetGroupModel> groupList = new List<GetGroupModel>(); // GetGroupModel OBjGroup = new GetGroupModel(); var groupData = db.tblGroups.Where(x => x.fkAdminId == objReq.userId).ToList(); // var groupData = db.tblGroups.Where(x => x.fkAdminId == objReq.userId).FirstOrDefault(); //OBjGroup.groupId = groupData.groupId; //OBjGroup.groupPic = Constants.imagepath + groupData.groupPic; //OBjGroup.subjectName = groupData.subjectName; //OBjGroup.timeSlot = groupData.timeSlot; foreach (var i in groupData) { GetGroupModel OBjGroup = new GetGroupModel(); OBjGroup.groupId = i.groupId; OBjGroup.groupPic = Constants.imagepath + i.groupPic; OBjGroup.subjectName = i.subjectName; OBjGroup.timeSlot = i.timeSlot; OBjGroup.groupName = i.groupName; OBjGroup.groupMembers = (from c in db.usp_P2GetGroupMembers(Convert.ToInt32(i.pkId)) select new BasicUserModel { userName = c.userName, profilePic = c.profilePic, userId = Convert.ToString(c.memberId) }).ToList(); // return OBjGroup groupList.Add(OBjGroup); } return groupList; } }
internal GetGroupModel GetGroupDetails(GetGroupRequest objReq) { using (var db = new WizzDataContext()) { var groupData = db.tblGroups.Where(x => x.groupId == objReq.groupId).FirstOrDefault(); GetGroupModel OBjGroup = new GetGroupModel(); OBjGroup.groupId = groupData.groupId; OBjGroup.groupPic = Constants.imagepath + groupData.groupPic; OBjGroup.subjectName = groupData.subjectName; OBjGroup.timeSlot = groupData.timeSlot; OBjGroup.groupName = groupData.groupName; OBjGroup.groupMembers = (from c in db.usp_P2GetGroupMembers(Convert.ToInt32(groupData.pkId)) select new BasicUserModel { userName = c.userName, profilePic = c.profilePic, userId = c.pkUserId.ToString() }).ToList(); return OBjGroup; } }