예제 #1
0
        public ActionResult <SpeakerDto> Create(TalkDto talkDto)
        {
            var model = mapper.Map <Talk>(talkDto);

            service.Add(model);
            service.Save();
            var talkRead = mapper.Map <TalkDto>(model);

            return(CreatedAtRoute(nameof(GetById), new { Id = talkDto.ID }, talkRead));
        }
예제 #2
0
 public IActionResult Create(TalkDto model)
 {
     if (ModelState.IsValid)
     {
         Talk newTalk = new Talk();
         newTalk = mapper.Map <Talk>(model);
         service.Add(newTalk);
         service.Save();
         return(RedirectToAction("List", "Talk"));
     }
     return(View(model));
 }
예제 #3
0
        public ActionResult Create(TalkDto model)
        {
            if (ModelState.IsValid)
            {
                //create a new Speaker
                Talk newTalk = new Talk();
                newTalk = mapper.Map <Talk>(model);
                service.Add(newTalk);
                ////save speaker
                service.Save();
                //redirect to List
                return(RedirectToAction("List", "Talks"));
            }

            return(View(model));
        }
예제 #4
0
 public IActionResult AddTalk([FromBody] Talk talk)
 {
     return(Ok(talkServices.Add(talk)));
 }