Example #1
0
        public IActionResult Edit(TalkDto incomingTalk)
        {
            if (incomingTalk.Id > 0)
            {
                if (ModelState.IsValid)
                {
                    var model = new Talk();
                    model = mapper.Map <Talk>(incomingTalk);
                    service.Update(model);
                    service.Save();
                    return(RedirectToAction("List", "Talk"));
                }
            }

            return(View(incomingTalk));
        }
Example #2
0
        public ActionResult Update(int id, TalkDto talkUpdateDto)
        {
            var model = service.getTalkById(id);

            if (model == null)
            {
                return(NotFound());
            }
            mapper.Map(talkUpdateDto, model);
            service.Update(model);
            service.Save();
            return(NoContent());
        }
 public IActionResult Edit(TalkDto incomingModel)
 {
     if (incomingModel.ID > 0)
     {
         if (ModelState.IsValid)
         {
             var talkInDb = new Talk();
             talkInDb = mapper.Map <Talk>(incomingModel);
             service.Update(talkInDb);
             service.Save();
             return(RedirectToAction("List", "Talks"));
         }
     }
     return(View(incomingModel));
 }
Example #4
0
 public IActionResult UpdateTalk(int id, [FromBody] Talk talk)
 {
     return(Ok(talkServices.Update(talk)));
 }