public IHttpActionResult Post(PostShow show) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateShowService(); if (!service.CreateShow(show)) { return(InternalServerError()); } return(Ok()); }
public bool CreateShow(PostShow model) { var entity = new Show() { Title = model.Title, Description = model.Description, Genre = (ShowGenre)model.Genre }; using (var ctx = new ApplicationDbContext()) { ctx.Shows.Add(entity); return(ctx.SaveChanges() == 1); } }