Example #1
0
        public ActionResult NewPost(Post postObj)
        {
            ResponseDTO response = new ResponseDTO();

            logginghelper.Log(LoggingLevels.Info, "Class: " + classname + " :: NewPost(httppost) - Begin");
            try
            {
                if (Session["CurrentUser"] != null)
                {
                    User _currentuser = Session["CurrentUser"] as User;
                    if (postObj.PostId > 0)
                    {
                        postObj.ModifiedBy   = _currentuser.UserId.ToString();
                        postObj.ModifiedDate = DateTime.Now;
                        response             = dataaccess.SavePost(postObj);
                    }
                    else
                    {
                        postObj.UserId      = _currentuser.UserId;
                        postObj.CreatedBy   = _currentuser.UserId;
                        postObj.CreatedDate = DateTime.Now;
                        response            = dataaccess.SavePost(postObj);
                    }
                }
            }
            catch (Exception ex)
            {
                logginghelper.Log(LoggingLevels.Error, "Class: " + classname + " :: NewPost(httppost)" + ex);
            }
            logginghelper.Log(LoggingLevels.Info, "Class: " + classname + " :: NewPost(httppost) - Begin");
            return(Json(response, JsonRequestBehavior.AllowGet));
        }