예제 #1
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);
        }
예제 #2
0
        public async Task <ActionResult> Delete(int id)
        {
            _logger.Info("Deleting Post! Id: " + id);

            try
            {
                await _postsManager.Delete(id, User.Identity.GetUserId());

                _logger.Info("Deleting Post Successfully!");

                return(Json("STATUS_OK"));
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Deleting Post Failed!");
                throw;
            }
        }