public async Task <ActionResult <ThuongNgayLe> > PostThuongNgayLe(ThuongNgayLe thuongNgayLe) { _context.ThuongNgayLe.Add(thuongNgayLe); await _context.SaveChangesAsync(); return(CreatedAtAction("GetThuongNgayLe", new { id = thuongNgayLe.IdthuongLe }, thuongNgayLe)); }
public async Task <IActionResult> PutThuongNgayLe(int id, ThuongNgayLe thuongNgayLe) { if (id != thuongNgayLe.IdthuongLe) { return(BadRequest()); } _context.Entry(thuongNgayLe).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ThuongNgayLeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }