Exemple #1
0
        public JsonResult createPost([FromBody] Post post)
        {
            Response        response        = new Response();
            PostDataHandler postDataHandler = new PostDataHandler(config);

            postDataHandler.clothId        = post.clothId;
            postDataHandler.userId         = post.userId;
            postDataHandler.isModelPresent = post.isModelPresent;
            postDataHandler.postId         = post.postId;
            postDataHandler.price          = post.price;
            postDataHandler.url            = post.url;
            response.status = postDataHandler.createPost();
            return(Json(response));
        }
Exemple #2
0
        public JsonResult createNewPost([FromBody] Post post)
        {
            Response        response        = new Response();
            PostDataHandler postDataHandler = new PostDataHandler(config);

            postDataHandler.clothId        = post.clothId;
            postDataHandler.userId         = post.userId;
            postDataHandler.isModelPresent = post.isModelPresent;
            postDataHandler.postId         = post.postId;
            postDataHandler.price          = post.price;
            postDataHandler.url            = post.url;
            post          = postDataHandler.createNewPost();
            response.data = JsonConvert.SerializeObject(post);
            return(Json(response));
        }
Exemple #3
0
        public JsonResult getFeeds(int userId)
        {
            Response        response        = new Response();
            PostDataHandler postDataHandler = new PostDataHandler(config);

            try
            {
                List <FeedViewModel> feeds = postDataHandler.getAllFeeds(userId);
                response.data   = JsonConvert.SerializeObject(feeds);
                response.status = true;
            }
            catch (Exception ex)
            {
                response.status  = false;
                response.message = ex.Message;
            }
            return(Json(response));
        }
Exemple #4
0
        private JsonResult findPosts(int searchId, string command)
        {
            Response        response        = new Response();
            PostDataHandler postDataHandler = new PostDataHandler(config);

            try {
                if (command.Equals("get"))
                {
                    Post post = postDataHandler.getPost(searchId);
                    response.data = JsonConvert.SerializeObject(post);
                }
                if (command.Equals("getAll"))
                {
                    List <Post> posts = postDataHandler.getAllPosts(searchId);
                    response.data = JsonConvert.SerializeObject(posts);
                }
                response.status = true;
            } catch (Exception ex) {
                response.status  = false;
                response.message = ex.Message;
            }
            return(Json(response));
        }