public async Task <IActionResult> PutCtPhieudathang(string id, CtPhieudathang ctPhieudathang) { if (id != ctPhieudathang.Id) { return(BadRequest()); } _context.Entry(ctPhieudathang).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CtPhieudathangExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <CtPhieudathang> > PostCtPhieudathang(CtPhieudathang ctPhieudathang) { _context.CtPhieudathangs.Add(ctPhieudathang); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (CtPhieudathangExists(ctPhieudathang.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetCtPhieudathang", new { id = ctPhieudathang.Id }, ctPhieudathang)); }