コード例 #1
0
        public IActionResult Post([FromHeader] string eventId, [FromBody] SpeakerRequest speaker)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _speakerService.Create(speaker, eventId);

            return(Ok());
        }
コード例 #2
0
        public ActionResult Create(SpeakersViewModel speakers)
        {
            if (ModelState.IsValid)
            {
                Speakers speakerToAdd = new Speakers();
                speakerToAdd.InjectFrom(speakers);
                speakerService.Create(speakerToAdd);

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View(speakers));
            }
        }