public JsonResult Add(string content)
        {
            string message = string.Empty;

            Post _post = new Post();

            string _loginUser = User.Identity.Name.ToString();

            User _CurrUser = db.Users.Where(x => x.UserName == _loginUser).FirstOrDefault();

            if (!String.IsNullOrEmpty(content))
            {
                string _postContent = content;

                _post.Content = _postContent;
                //_post.CreatedBy = "rasel";
                _post.CreatedDate = DateTime.Now;
                _post.PostTypeId = 2;//post type

                _post.User = _CurrUser;

                try
                {
                    db.Posts.Add(_post);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    message = ex.Message;
                }

            }
            else
            {
                message = "error!";
            }

            return Json(new
            {
                Html = this.RenderPartialView("_Post", _post),
                Message = message
            }, JsonRequestBehavior.AllowGet);
        }
        public JsonResult PostPoll(string content, string answers)
        {
            string message = string.Empty;

            Post _post = new Post();

            string _loginUser = User.Identity.Name.ToString();

            JavaScriptSerializer serializer = new JavaScriptSerializer();

            //for item list
            List<string> itemAnswer = serializer.Deserialize<List<string>>(answers);

            //User _user = db.Users.Where(x => x.UserName == _loginUser).FirstOrDefault();

            User _CurrUser = db.Users.Where(x => x.UserName == _loginUser).FirstOrDefault();

            if (!String.IsNullOrEmpty(content))
            {
                string _postContent = content;

                _post.Content = _postContent;
                //_post.CreatedBy = "rasel";
                _post.CreatedDate = DateTime.Now;
                _post.PostTypeId = 4; //post type for poll type id

                _post.User = _CurrUser;

                try
                {
                    //one to one relational data insert
                    db.Posts.Add(_post);
                    db.SaveChanges();

                    _post.PollPost = new PollPost { PostId = _post.PostId };
                    db.SaveChanges();

                    PollPost _tempPoll = db.PollPosts.Where(x => x.PostId == _post.PostId).FirstOrDefault();

                    if (_tempPoll != null)
                    {
                        int _pAnsId = db.PollAnswers.Count();

                        foreach (var item in itemAnswer.ToList())
                        {
                            _pAnsId++;
                            PollAnswers _pollAnswer = new PollAnswers();
                            _pollAnswer.Id = "" + _pAnsId;
                            _pollAnswer.AnswerContent = item;
                            _pollAnswer.PollPostId = _tempPoll.Id;
                            db.PollAnswers.Add(_pollAnswer);
                        }
                        db.SaveChanges();
                    }

                }
                catch (Exception ex)
                {
                    message = ex.Message;
                }

            }
            else
            {
                message = "error!";
            }

            return Json(new
            {
                Html = this.RenderPartialView("_PostPoll", _post),
                Message = message
            }, JsonRequestBehavior.AllowGet);

            //return PartialView("_Post", _post);
        }
        public JsonResult PostLikeShowUpdate(string pid)
        {
            string message = string.Empty;

            string _loginUser = User.Identity.Name.ToString();

            int _postId = Convert.ToInt32(pid);

            Post _post = db.Posts.Where(x => x.PostId == _postId).FirstOrDefault();

            Post _viewPost = new Post();

            if (_post != null)
            {
                _viewPost.LikeStatues = _post.LikeStatues;
            }

            return Json(new
            {
                Html = this.RenderPartialView("_PostLikeShowUpdate", _viewPost),
                Message = message
            }, JsonRequestBehavior.AllowGet);
        }
        public JsonResult PostEvent(string content, string month, string date, string time, string duration, string venue, string note)
        {
            string message = string.Empty;

            //string content = postUpdateBox;

            Post _post = new Post();

            string _loginUser = User.Identity.Name.ToString();

            //User _user = db.Users.Where(x => x.UserName == _loginUser).FirstOrDefault();

            User _CurrUser = db.Users.Where(x => x.UserName == _loginUser).FirstOrDefault();

            if (!String.IsNullOrEmpty(content))
            {
                string _postContent = content;
                int _postEventMonth = Convert.ToInt32(month);
                int _postEventDate = Convert.ToInt32(date);
                string _postEventTime = time;
                string _postEventDuration = duration;
                string _postEventVenue = venue;
                string _postEventNote = note;

                DateTime _eventTime = DateTime.Parse(_postEventTime);

                DateTime _eventDateTime = new DateTime(DateTime.Now.Year, _postEventMonth, _postEventDate, _eventTime.Hour, _eventTime.Minute, _eventTime.Millisecond);

                _post.Content = _postContent;
                //_post.CreatedBy = "rasel";
                _post.CreatedDate = DateTime.Now;
                _post.PostTypeId = 3; // post type for event type id

                _post.User = _CurrUser;

                try
                {
                    //one to one relational table data insert
                    db.Posts.Add(_post);
                    db.SaveChanges();

                    _post.EventPost = new EventPost { PostId = _post.PostId, EventDateTime = _eventDateTime, EventDuration = _postEventDuration, EventVenue = _postEventVenue, EventNote = _postEventNote };
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    message = ex.Message;
                }

            }
            else
            {
                message = "error!";
            }

            return Json(new
            {
                Html = this.RenderPartialView("_PostEvent", _post),
                Message = message
            }, JsonRequestBehavior.AllowGet);

            //return PartialView("_Post", _post);
        }