예제 #1
0
        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));
        }
예제 #2
0
 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));
     }
 }