示例#1
0
        public void Handle(CreateConferenceCommand command)
        {
            Conference conference = new Conference();

            conference.Handle(command);

            conferenceRepository.Create(conference);
        }
 public IActionResult Create(ConferenceCreateModel form)
 {
     if (ModelState.IsValid)
     {
         var conf = new Conference
         {
             Name = form.Name
         };
         repository.Create(conf);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
示例#3
0
            public Task <Response> Handle(Command command, CancellationToken cancellationToken)
            {
                var response = new Response
                {
                    Succeeded = true
                };
                var conference = new Conference
                {
                    Name = command.Name
                };

                repository.Create(conference);
                return(Task.FromResult(response));
            }
示例#4
0
        public async Task CreateConference(ConferenceInfo conference)
        {
            if (await _conferenceRepository.CheckExistenceBySlug(conference.Slug))
            {
                throw new DuplicateNameException("The chosen conference slug is already taken.");
            }

            // Conference publishing is explicit.
            if (conference.IsPublished)
            {
                conference.IsPublished = false;
            }

            await _conferenceRepository.Create(conference);

            _hostServiceBus.Publish <IConferenceCreated>(new ConferenceCreated(conference));
        }