public bool UpdateCareerStatsWR(CareerStatsWREdit career) { using (var ctx = new ApplicationDbContext()) { var entity = ctx .CareerStatsWRs .Single(c => c.CareerWRId == career.CareerWRId); entity.PlayerId = career.PlayerId; entity.Name = career.Name; return(ctx.SaveChanges() == 1); } }
public IHttpActionResult Put(CareerStatsWREdit careerStatsWR) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } CareerStatsWRService careerService = new CareerStatsWRService(); if (!careerService.UpdateCareerStatsWR(careerStatsWR)) { return(InternalServerError()); } return(Ok()); }