示例#1
0
        public void Delete(string year, string id)
        {
            var command = new DeleteNews
            {
                Id   = Guid.Parse(id),
                Year = year
            };

            Domain.Dispatcher.SendCommand(command);
        }
示例#2
0
        public IEnumerable Handle(Func <Guid, TournamentAggregate> al, DeleteNews command)
        {
            var tournament = CommandQueries.GetTournaments().FirstOrDefault(x => x.Year == command.Year);
            var agg        = al(tournament.Id);

            yield return(new NewsDeleted
            {
                Id = tournament.Id,
                NewsId = command.Id,
            });
        }
示例#3
0
        public object Delete(DeleteNews request)
        {
            var context = TepWebContext.GetWebContext(PagePrivileges.AdminOnly);

            try {
                context.Open();
                context.LogInfo(this, string.Format("/news/{{Id}} DELETE Id='{0}'", request.Id));
                Terradue.Portal.Article news = Terradue.Portal.Article.FromId(context, request.Id);
                news.Delete();

                context.Close();
            } catch (Exception e) {
                context.LogError(this, e.Message, e);
                context.Close();
                throw e;
            }
            return(new WebResponseBool(true));
        }
示例#4
0
 public IActionResult Remove(int id,
                             [FromServices] DeleteNews deleteNews)
 {
     deleteNews.Do(id);
     return(RedirectToAction("Index"));
 }