public bool UpdateUserRatingQuote(UserRatingQuoteEdit model) { using (var ctx = new ApplicationDbContext()) { var entity = ctx .UserRatingQuotes .SingleOrDefault(e => e.UserRatingQuoteId == model.UserRatingQuoteId); entity.UserRatingQuoteId = model.UserRatingQuoteId; entity.UserRating = model.UserRating; return(ctx.SaveChanges() == 1); } }
public IHttpActionResult Put(UserRatingQuoteEdit userRatingQuote) { if (userRatingQuote == null) { return(BadRequest("Received model was null.")); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateUserRatingQuoteService(); if (!service.UpdateUserRatingQuote(userRatingQuote)) { return(InternalServerError()); } return(Ok()); }