public ActionResult Create(EditionViewModel model) { if (ModelState.IsValid) { Editions editionToCreate = new Editions(); editionToCreate.InjectFrom(model); var createNewEdition = editions.CreateEdition(editionToCreate); if (createNewEdition == null) { ModelState.AddModelError("Name", "The Name must be unique!"); return(View(model)); } return(RedirectToAction(nameof(Index))); } else { return(View(model)); } }
public async Task <HttpResponseMessage> Create([FromBody] EditionModel edition) { var result = await _editionService.CreateEdition(edition); return(result.CreateRespose(HttpStatusCode.Created, HttpStatusCode.BadRequest)); }