public override void Update(WebContent entity) { var dbEntityEntry = context.Entry(entity); entity.ModifiedDate = DateTime.Now; if (dbEntityEntry.State != EntityState.Detached) { dbEntityEntry.State = EntityState.Modified; } dbEntityEntry.State = EntityState.Modified; context.SaveChanges(); }
public IActionResult Put(WebContent patch) { var key = patch.WebContentId; // Validate(patch.GetEntity()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.WebContent.Update(patch); _context.SaveChanges(); // if (webContent == null) // { // return NotFound(); // } // TO DO: need to fix this! // patch.Put(webContent); // try // { // Contents.Update (patch); // } // catch (System.Exception) // { // if (!WebContentExists(key)) // { // return NotFound(); // } // else // { // throw; // } // } return(Ok(_context.WebContent.Find(patch.WebContentId))); }