コード例 #1
0
        public ActionResult Edit(int id, TalksViewModel model)
        {
            Talks talk = new Talks();

            talk.InjectFrom(model);
            var talkToUpdate = talkService.UpdateTalk(talk);

            return(RedirectToAction(nameof(Index)));
        }
コード例 #2
0
        public async Task <ActionResult <TalkModel> > Put(string moniker, int id, TalkModel model)
        {
            var res = await _talkService.UpdateTalk(moniker, id, model);

            switch (res.statusCode)
            {
            case 404:
                return(NotFound(res.message));

            case 400:
                return(BadRequest(res.message));

            case 500:
                return(StatusCode(StatusCodes.Status500InternalServerError, res.message));

            default:
                return(res.talkModel);
            }
        }