public async Task <IActionResult> PutTextDashoardItem([FromRoute] int?id, [FromBody] TextDashoardItem textDashoardItem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != textDashoardItem.Id) { return(BadRequest()); } _context.Entry(textDashoardItem).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TextDashoardItemExists(id)) { return(NotFound()); } else { throw; } } return(Ok(textDashoardItem)); }
public async Task <IActionResult> PostTextDashoardItem([FromBody] TextDashoardItem textDashoardItem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.TextDashoardItem.Add(textDashoardItem); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTextDashoardItem", new { id = textDashoardItem.Id }, textDashoardItem)); }