コード例 #1
0
        public IActionResult Post(Artist a)
        {
            //if (!ModelState.IsValid) return BadRequest();
            var newArtist = artistsService.AddArtist(a);

            //return Created("http://" + newArtist.Id, newArtist);
            return(CreatedAtAction("get", newArtist));
        }
コード例 #2
0
        public ActionResult AddConfirm(NewArtistViewModel model)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.Message = _helperService.ModelErrorsToString(ModelState);
                return(View("Add"));
            }
            var id = _artistsService.AddArtist(model);

            return(RedirectToAction("Details", new { Id = id }));
        }