public override IActionResult Post([FromBody] Season value) { var series = SeriesRepository.Find(value.SeriesId); if (!ModelState.IsValid || series == null) { return(BadRequest(ModelState)); } Repository.Add(value, autoSave: true); return(CreatedAtAction("Get", new { id = value.ID }, value)); }
public ActionResult CreateSeason(Season model, int seriesID) { if (ModelState.IsValid) { model.SeriesId = seriesID; this.SeasonRepository.Add(model, autoSave: true); return(RedirectToAction("Index")); } else { this.FillDropDownValues(SeriesRepository.Find(seriesID).Categories); return(View(model)); } }