public async Task <IActionResult> PutThongTinKd(string id, ThongTinKd thongTinKd) { if (id != thongTinKd.MaKd) { return(BadRequest()); } _context.Entry(thongTinKd).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ThongTinKdExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <ThongTinKd> > PostThongTinKd(ThongTinKd thongTinKd) { _context.ThongTinKd.Add(thongTinKd); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (ThongTinKdExists(thongTinKd.MaKd)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetThongTinKd", new { id = thongTinKd.MaKd }, thongTinKd)); }