public bool CreateTVShow(TVShowCreate model) { var entity = new TVShow() { MediaType = model.MediaType, Title = model.Title, Creator = model.Creator, Stars = model.Stars, Synopsis = model.Synopsis, Genre1 = model.Genre1, Genre2 = model.Genre2, Network = model.Network, Year = model.Year, Released = model.Released, Rating = model.Rating, Runtime = model.Runtime }; using (var ctx = new ApplicationDbContext()) { ctx.TVShows.Add(entity); return(ctx.SaveChanges() == 1); } }
public ActionResult Create(TVShowCreate tVShowCreate) { if (ModelState.IsValid) { _db.TVShowCreates.Add(tVShowCreate); _db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tVShowCreate)); }
public IHttpActionResult Post(TVShowCreate show) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateTVShowService(); if (!service.CreateTVShow(show)) { return(InternalServerError()); } return(Ok()); }
public ActionResult Create(TVShowCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = CreateTVShowService(); if (service.CreateTVShow(model)) { TempData["SaveResult"] = "Your TV Show or Documentary was created."; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Your TV Show or Documentary could not be created."); return(View(model)); }
public bool CreateTVShow(TVShowCreate model) { var entity = new TVShow() { UserId = _userID, CrimeID = model.CrimeID, Crime = model.Crime, Title = model.Title, Description = model.Description, Channel_OnlineStream = model.Channel_OnlineStream, CreatedUtc = DateTimeOffset.Now }; using (var ctx = new ApplicationDbContext()) { ctx.TVShows.Add(entity); return(ctx.SaveChanges() == 1); } }
public bool CreateTVShow(TVShowCreate model) { var entity = new TVShow() { Title = model.Title, Description = model.Description, Genre = model.Genre, TVMaturityRating = model.TVMaturityRating, AverageEpisodeLength = model.AverageEpisodeLength, TotalEpisodes = model.TotalEpisodes, TotalSeasons = model.TotalSeasons, }; using (var ctx = new ApplicationDbContext()) { ctx.Shows.Add(entity); return(ctx.SaveChanges() == 1); } }
public ActionResult Create(TVShowCreate model) { model.MediaType = MediaType.Television; if (!ModelState.IsValid) { return(View(model)); } var service = new TelevisionService(); if (service.CreateTVShow(model)) { TempData["SaveResult"] = "The show was created."; return(RedirectToAction("Index")); } ; ModelState.AddModelError("", "The show could not be created."); return(View(model)); }