Esempio n. 1
0
        private void dataGridViev_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            NamePost           = dataGridViev[1, IndexRow].Value.ToString();
            ContentPost        = dataGridViev[2, IndexRow].Value.ToString();
            this.Visible       = false;;
            this.ShowInTaskbar = false;
            ShowPost changePost = new ShowPost(NamePost, ContentPost);

            changePost.ShowDialog();
        }
Esempio n. 2
0
        public IActionResult ShowPost(int id)
        {
            ArrayList lista = new ArrayList();

            lista.Add(id);

            var applications = _applicationRepo.GetAllWithFilter(lista);
            var ex           = applications.Exists(x => x.UserID == int.Parse(_user.GetUserId(User)));

            var post = _postRepo.Get(id);

            ArrayList arr = new ArrayList();

            arr.Add(post.ApplicationUserID);
            arr.Add(int.Parse(_user.GetUserId(User)));
            arr.Add(post.PostID);
            var  rex = _ratingsRepo.Exists(arr);
            bool acc = false;

            if (ex)
            {
                acc = applications.Where(x => x.UserID == int.Parse(_user.GetUserId(User))).FirstOrDefault().Accepted;
            }

            Rating rating = null;

            if (rex)
            {
                ArrayList rat = new ArrayList();

                rat.Add(_postRepo.Get(id).ApplicationUserID);

                var ratings = new List <Rating>();

                ratings = _ratingsRepo.GetAllWithFilter(lista);

                rating = ratings.Where(x => x.RaterID == int.Parse(_user.GetUserId(User)) && x.PostID == id).FirstOrDefault();
            }

            var model = new ShowPost
            {
                Post         = _postRepo.Get(id),
                Applications = applications,
                Accepted     = acc,
                Ocjena       = rating
            };

            return(View(model));
        }