Exemplo n.º 1
0
        public IActionResult Delete(int id)
        {
            var topic = topicManager.FindTopicById(id);

            topicManager.DeleteTopic(topic);
            return(RedirectToAction(nameof(Index)));
        }
Exemplo n.º 2
0
 protected void DeleteButton_Click(object sender, EventArgs e)
 {
     try
     {
         TopicManager.DeleteTopic(this.TopicID);
         Response.Redirect("Topics.aspx");
     }
     catch (Exception exc)
     {
         ProcessException(exc);
     }
 }
        public IActionResult Delete([FromRoute] int topicId)
        {
            if (!_topicPermissions.IsAllowedToEdit(User.Identity.GetUserIdentity(), topicId))
            {
                return(Forbidden());
            }
            if (_topicManager.DeleteTopic(topicId, User.Identity.GetUserIdentity()))
            {
                return(Ok());
            }

            return(NotFound());
        }
Exemplo n.º 4
0
        public TransactionObject DeleteTopic(int ID)
        {
            TransactionObject response = new TransactionObject();

            try
            {
                topicManager.DeleteTopic(ID);

                uow.Save();

                response.IsSuccess = true;
            }
            catch (Exception ex)
            {
                response.IsSuccess   = false;
                response.Explanation = base.GetExceptionMessage(ex);
            }

            return(response);
        }