//Find destination and update Info given public bool UpdateDestination(DestEdit model) { using (var ctx = new ApplicationDbContext()) { var entity = ctx .Destinations .Single(e => e.DestId == model.DestId); entity.DestId = model.DestId; entity.DestName = model.DestName; entity.GenreId = model.GenreId; return(ctx.SaveChanges() == 1); } }
public IHttpActionResult Put(DestEdit destination) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateDestService(); if (!service.UpdateDestination(destination)) { return(InternalServerError()); } return(Ok()); }