コード例 #1
0
        private void GetPosts(int state)
        {
            UserServices userServices = new UserServices();
            string       query        = "SELECT P.ID_POST, U.NAME, U.LASTNAME, U.PROFILE_PICTURE, P.TITLE, P.CAPTION, P.TIMEDATE FROM POST P" +
                                        " INNER JOIN USERS U ON P.ID_USER = U.ID_USER" +
                                        " WHERE P.ID_USER = "******" AND P.VISIBLE = " + state;
            PostServices postServices = new PostServices();

            dt = postServices.Get(query);
        }
コード例 #2
0
        //
        // GET: Posts/Details/id
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            ViewBag.ForumCategories = await _forumCategriesManager.ListCategoriesForLinks();

            ViewBag.Themes = await _themesManager.ListThemesForLinks();

            ViewBag.PopularPosts = await _postsManager.ListMostPopular();

            ViewBag.LatestComments = await _commentsManager.ListLatest();

            ViewBag.FlickrPhotos = new ImageCollectionViewModel
            {
                CollectionName = "Flickr снимки",
                ImageUrls      = new List <string>
                {
                    "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQcu__MdyeKEmtW-Ki5Bg12YYPJXN5rxQjYewBsc46LYhR3K-Xj",
                    "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQcu__MdyeKEmtW-Ki5Bg12YYPJXN5rxQjYewBsc46LYhR3K-Xj",
                    "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQcu__MdyeKEmtW-Ki5Bg12YYPJXN5rxQjYewBsc46LYhR3K-Xj",
                    "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQcu__MdyeKEmtW-Ki5Bg12YYPJXN5rxQjYewBsc46LYhR3K-Xj",
                    "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQcu__MdyeKEmtW-Ki5Bg12YYPJXN5rxQjYewBsc46LYhR3K-Xj",
                    "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQcu__MdyeKEmtW-Ki5Bg12YYPJXN5rxQjYewBsc46LYhR3K-Xj"
                }
            };
            ViewBag.Tags = await _tagsManager.ListPopularTagNames();

            ViewBag.RelatedPosts = await _postsManager.GetRelatedPosts((int)id, 2);

            ViewBag.HeighestScoredPosts = (await _postsManager.GetHeighestScored()).Take(3).ToList();

            await _postsManager.IncreaseViews((int)id);

            var post = await _postsManager.Get((int)id);

            return(View(post));
        }
コード例 #3
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            Options options = new Options();

            options.ID_Post = ID_Post;
            options.visible = Visible;
            DialogResult dr = options.ShowDialog();

            if (dr == DialogResult.Yes)
            {
                Post post = new Post();
                post.Editar   = true;
                post.PostEdit = postServices.Get("SELECT * FROM POST WHERE ID_POST = " + ID_Post);
                post.ShowDialog();
            }
            else if (dr == DialogResult.No)
            {
                if (postServices.EditVisiblity(ID_Post, 0))
                {
                    MessageBox.Show("El post fue ocultado");
                }
                else
                {
                    MessageBox.Show("La accion no pudo realizarse correctamente");
                }
            }
            else if (dr == DialogResult.OK)
            {
                if (postServices.Delete(ID_Post))
                {
                    MessageBox.Show("Publicacion eliminada correctamente");
                }
                else
                {
                    MessageBox.Show("La accion no pudo realizarse correctamente");
                }
            }
            else if (dr == DialogResult.Retry)
            {
                if (postServices.EditVisiblity(ID_Post, 1))
                {
                    MessageBox.Show("El post ya puede ser visualizado");
                }
                else
                {
                    MessageBox.Show("La accion no pudo realizarse correctamente");
                }
            }
            options.Close();
            options.Dispose();
            OnRefresh(e);
        }
コード例 #4
0
 public ActionResult <List <Post> > Get()
 {
     return(_postService.Get());
 }