public HotBev Post([FromBody] HotBev hotBev) { var userId = HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier); hotBev.UserId = userId; _context.HotBevs.Add(hotBev); _context.SaveChanges(); return(hotBev); }
public HotBev Put([FromRoute] int id, [FromBody] HotBev hotBev) { // var currentHotBev = _context.HotBevs.Find(HotBev.Id); // I think this is the one I want: var currentHotBev = _context.HotBevs.Find(hotBev.Id); if (currentHotBev == null) { return(null); } _context.Entry(currentHotBev).CurrentValues.SetValues(hotBev); _context.HotBevs.Update(currentHotBev); _context.SaveChanges(); return(currentHotBev); }