コード例 #1
0
        public void delete(long blog_id)
        {
            try
            {
                using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required))
                {
                    var BlogCommentCategory = _blogCommentRepo.getById(blog_id);
                    if (BlogCommentCategory == null)
                    {
                        throw new ItemNotFoundException($"Blog Comment Category With Id {BlogCommentCategory} doesnot Exist.");
                    }

                    _blogCommentRepo.delete(BlogCommentCategory);
                    tx.Complete();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public IActionResult blogCommentEdit(long blog_comment_id)
        {
            try
            {
                var            blogComment    = _blogCommentRepo.getById(blog_comment_id);
                BlogCommentDto blogCommentDto = _mapper.Map <BlogCommentDto>(blogComment);

                return(View(blogCommentDto));
            }
            catch (Exception ex)
            {
                AlertHelper.setMessage(this, ex.Message, messageType.error);
                return(RedirectToAction("index"));
            }
        }