Exemple #1
0
        public JsonResult PostUserCreatePost(string title, string content)
        {
            var user     = ActionContext.Request.Headers.Authorization.Parameter;
            var userInfo = GetMethods.GetUserInformationByBase64(user);
            var res      = CreateNewPost(userInfo.UserId, title, content);

            if (res == 1)
            {
                return new JsonResult
                       {
                           Data = new{ status = "successful" }
                       }
            }
            ;

            var err = ErrorMethods.Handle500();

            JsonConvert.SerializeObject(err);
            return(new JsonResult
            {
                Data = err,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,

                ContentType = "application/json"
            });
        }