public async Task <IActionResult> PutTipsForEveryOne([FromRoute] Guid id, [FromBody] TipsForEveryOne tipsForEveryOne) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tipsForEveryOne.Id) { return(BadRequest()); } _context.Entry(tipsForEveryOne).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TipsForEveryOneExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostTipsForEveryOne([FromBody] TipsForEveryOne tipsForEveryOne) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.TipsForEveryOne.Add(tipsForEveryOne); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTipsForEveryOne", new { id = tipsForEveryOne.Id }, tipsForEveryOne)); }