コード例 #1
0
        public virtual IActionResult TopicTemplateDelete(int id)
        {
            //try to get a topic template with the specified id
            TopicTemplate template = _topicTemplateService.GetTopicTemplateById(id)
                                     ?? throw new ArgumentException("No template found with the specified id");

            _topicTemplateService.DeleteTopicTemplate(template);

            return(new NullJsonResult());
        }
コード例 #2
0
        public virtual IActionResult TopicTemplateDelete(int id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance))
            {
                return(AccessDeniedView());
            }

            //try to get a topic template with the specified id
            var template = _topicTemplateService.GetTopicTemplateById(id)
                           ?? throw new ArgumentException("No template found with the specified id");

            _topicTemplateService.DeleteTopicTemplate(template);

            return(new NullJsonResult());
        }
コード例 #3
0
        public IActionResult TopicTemplateDelete(string id)
        {
            var template = _topicTemplateService.GetTopicTemplateById(id);

            if (template == null)
            {
                throw new ArgumentException("No template found with the specified id");
            }
            if (ModelState.IsValid)
            {
                _topicTemplateService.DeleteTopicTemplate(template);
                return(new NullJsonResult());
            }
            return(ErrorForKendoGridJson(ModelState));
        }
コード例 #4
0
        public IActionResult TopicTemplateDelete(string id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance))
            {
                return(AccessDeniedView());
            }

            var template = _topicTemplateService.GetTopicTemplateById(id);

            if (template == null)
            {
                throw new ArgumentException("No template found with the specified id");
            }

            _topicTemplateService.DeleteTopicTemplate(template);

            return(new NullJsonResult());
        }
コード例 #5
0
ファイル: TopicsController.cs プロジェクト: thophamhuu/APIWB
 /// <summary>
 /// Delete topic template
 /// </summary>
 /// <param name="topicTemplate">Topic template</param>
 public void DeleteTopicTemplate([FromBody] TopicTemplate topicTemplate)
 {
     _topicTemplateService.DeleteTopicTemplate(topicTemplate);
 }