public Response<GetGroupModel> GetGroups(GroupEntity objReq)
        {
            // GroupModel objReq = new GroupModel();
            Response<GetGroupModel> response = new Response<GetGroupModel>();
            List<GetGroupModel> objResp = new List<GetGroupModel>();

            try
            {
                DbMethodsV2 objDBMethodV2 = new DbMethodsV2();

                if (CheckRequestIsvalidornot(this.Request))
                {


                    objResp = objDBMethodV2.GetGroup(objReq);

                    if (objResp.Count > 0)
                    {
                        response.Create(true, Messages.FormatMessage(Messages.Success, "Group List"), Messages.AppVersion, objResp);

                    }
                    else
                    {
                        response.Create(false, Messages.InvalidReq, Messages.AppVersion, objResp);
                    }

                }
                else
                {
                    response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

                }

            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error(ex.Message, ex, session, ex.Message);
                response.Create(false, "Error occured while Processing Webservice request", Messages.AppVersion, objResp);
            }
            finally
            {
            }
            return response;
        }
示例#2
0
        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;
            }
        }