public ActionResult WatchMyPost(string Id)
        {
            var list = new List <PostCommentVModel>();
            //var Posts = context.MemUserLocationComplains.Where(x => x.Location == loca).ToList();
            string sql = string.Format("select * from MemberUserLocationWiseComplains where Email = '" + Id + "' order by StatusNo desc");
            //var items = context.Database.SqlQuery<MembersComplainList>(sql).ToList();

            //var Posts = context.MemUserLocationComplains.ToList();
            var Posts = context.Database.SqlQuery <MemberUserLocationWiseComplain>(sql).ToList();

            Posts.ForEach(x => {
                var pm = new PostCommentVModel()
                {
                    PostId     = x.StatusNo,
                    Location   = x.Location,
                    Post       = x.Post,
                    StatusPost = x.Status,
                    Date       = x.Date,
                    Email      = x.Email,
                    Agree      = x.Agree,
                    Disagree   = x.Disagree
                };
                var UserCookie    = Request.Cookies["usId"].Value.ToString();
                var ActionChecker = context.CommentAgreeDisagreeStatuses.FirstOrDefault(y => y.PostId == pm.PostId && y.UserEmail == UserCookie);
                if (ActionChecker != null)
                {
                    pm.Action = ActionChecker.Action;
                }
                else
                {
                    pm.Action = 0;
                }
                var comments = context.MemUserCompCommants.Where(y => y.Status == x.StatusNo).ToList();
                pm.Comments  = comments;
                list.Add(pm);
            });

            return(View("~/Views/Member/Partial/PostComment.cshtml", list));
        }
        public ActionResult WatchCouncilorPost(string loca)
        {
            var list = new List <PostCommentVModel>();

            if (loca == "" || loca == "--- Select Location ---")
            {
                //string sql = string.Format("select CMP.StatusNo, CMP.Email,CMP.Location, convert (int,CMP.Status) AS StatusPost, CMP.Date, CMP.Post, ISNULL(CMMENT.ID, '') AS Id,ISNULL(CMMENT.Status, '') AS Status, ISNULL(CMMENT.Comment, '') AS Comment,ISNULL(CMMENT.Email, '') AS CmmentEmail from MemberUserLocationWiseComplains CMP left Join MemberUserLocationWiseComplainCommants CMMENT On CMP.StatusNo = CMMENT.Status");
                string sql = string.Format("select * from MemberUserLocationWiseComplains where Role=1 order by StatusNo desc");
                //var items = context.Database.SqlQuery<MembersComplainList>(sql).ToList();

                //var Posts = context.MemUserLocationComplains.ToList();
                var Posts = context.Database.SqlQuery <MemberUserLocationWiseComplain>(sql).ToList();

                Posts.ForEach(x => {
                    var pm = new PostCommentVModel()
                    {
                        PostId     = x.StatusNo,
                        Location   = x.Location,
                        Post       = x.Post,
                        StatusPost = x.Status,
                        Date       = x.Date,
                        Email      = x.Email,
                        Agree      = x.Agree,
                        Disagree   = x.Disagree
                    };
                    var comments      = context.MemUserCompCommants.Where(y => y.Status == x.StatusNo).ToList();
                    var UserCookie    = Request.Cookies["usId"].Value.ToString();
                    var ActionChecker = context.CommentAgreeDisagreeStatuses.FirstOrDefault(y => y.PostId == pm.PostId && y.UserEmail == UserCookie);
                    if (ActionChecker != null)
                    {
                        pm.Action = ActionChecker.Action;
                    }
                    else
                    {
                        pm.Action = 0;
                    }
                    pm.Comments = comments;
                    list.Add(pm);
                });

                //return Json(new { datas = items }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                //var Posts = context.MemUserLocationComplains.Where(x => x.Location == loca).ToList();
                string sql = string.Format("select * from MemberUserLocationWiseComplains where Location = '" + loca + "' and Role = 1 order by StatusNo desc");
                //var items = context.Database.SqlQuery<MembersComplainList>(sql).ToList();

                //var Posts = context.MemUserLocationComplains.ToList();
                var Posts = context.Database.SqlQuery <MemberUserLocationWiseComplain>(sql).ToList();

                Posts.ForEach(x => {
                    var pm = new PostCommentVModel()
                    {
                        PostId     = x.StatusNo,
                        Location   = x.Location,
                        Post       = x.Post,
                        StatusPost = x.Status,
                        Date       = x.Date,
                        Email      = x.Email,
                        Agree      = x.Agree,
                        Disagree   = x.Disagree
                    };
                    var UserCookie    = Request.Cookies["usId"].Value.ToString();
                    var ActionChecker = context.CommentAgreeDisagreeStatuses.FirstOrDefault(y => y.PostId == pm.PostId && y.UserEmail == UserCookie);
                    if (ActionChecker != null)
                    {
                        pm.Action = ActionChecker.Action;
                    }
                    else
                    {
                        pm.Action = 0;
                    }
                    var comments = context.MemUserCompCommants.Where(y => y.Status == x.StatusNo).ToList();
                    pm.Comments  = comments;
                    list.Add(pm);
                });

                //return Json(new { datas = items }, JsonRequestBehavior.AllowGet);
            }
            return(View("~/Views/Member/Partial/PostComment.cshtml", list));
        }
        public ActionResult CatagoryPost(string loca, string status)
        {
            var list = new List <PostCommentVModel>();

            if (status == "Accepted")
            {
                //var Posts = context.MemUserLocationComplains.Where(x => x.Location == loca).ToList();
                string sql = string.Format("select * from MemberUserLocationWiseComplains where Location = '" + loca + "' and Role = 0 and Status=2 order by StatusNo desc");
                //var items = context.Database.SqlQuery<MembersComplainList>(sql).ToList();

                //var Posts = context.MemUserLocationComplains.ToList();
                var Posts = context.Database.SqlQuery <MemberUserLocationWiseComplain>(sql).ToList();

                Posts.ForEach(x => {
                    var pm = new PostCommentVModel()
                    {
                        PostId     = x.StatusNo,
                        Location   = x.Location,
                        Post       = x.Post,
                        StatusPost = x.Status,
                        Date       = x.Date,
                        Email      = x.Email,
                        Agree      = x.Agree,
                        Disagree   = x.Disagree
                    };
                    var UserCookie    = Request.Cookies["usId"].Value.ToString();
                    var ActionChecker = context.CommentAgreeDisagreeStatuses.FirstOrDefault(y => y.PostId == pm.PostId && y.UserEmail == UserCookie);
                    if (ActionChecker != null)
                    {
                        pm.Action = ActionChecker.Action;
                    }
                    else
                    {
                        pm.Action = 0;
                    }
                    var comments = context.MemUserCompCommants.Where(y => y.Status == x.StatusNo).ToList();
                    pm.Comments  = comments;
                    list.Add(pm);
                });

                //return Json(new { datas = items }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                //var Posts = context.MemUserLocationComplains.Where(x => x.Location == loca).ToList();
                string sql = string.Format("select * from MemberUserLocationWiseComplains where Location = '" + loca + "' and Role = 0 and Status=1 order by StatusNo desc");
                //var items = context.Database.SqlQuery<MembersComplainList>(sql).ToList();

                //var Posts = context.MemUserLocationComplains.ToList();
                var Posts = context.Database.SqlQuery <MemberUserLocationWiseComplain>(sql).ToList();

                Posts.ForEach(x => {
                    var pm = new PostCommentVModel()
                    {
                        PostId     = x.StatusNo,
                        Location   = x.Location,
                        Post       = x.Post,
                        StatusPost = x.Status,
                        Date       = x.Date,
                        Email      = x.Email,
                        Agree      = x.Agree,
                        Disagree   = x.Disagree
                    };
                    var UserCookie    = Request.Cookies["usId"].Value.ToString();
                    var ActionChecker = context.CommentAgreeDisagreeStatuses.FirstOrDefault(y => y.PostId == pm.PostId && y.UserEmail == UserCookie);
                    if (ActionChecker != null)
                    {
                        pm.Action = ActionChecker.Action;
                    }
                    else
                    {
                        pm.Action = 0;
                    }
                    var comments = context.MemUserCompCommants.Where(y => y.Status == x.StatusNo).ToList();
                    pm.Comments  = null;
                    list.Add(pm);
                });

                //return Json(new { datas = items }, JsonRequestBehavior.AllowGet);
            }
            return(View("~/Views/Councilor/Partial/PostComment.cshtml", list));
        }