public async Task <IActionResult> PutDongTb(string id, DongTb dongTb) { if (id != dongTb.IddongTb) { return(BadRequest()); } _context.Entry(dongTb).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DongTbExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <DongTb> > PostDongTb(DongTb dongTb) { _context.DongTb.Add(dongTb); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (DongTbExists(dongTb.IddongTb)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetDongTb", new { id = dongTb.IddongTb }, dongTb)); }