public async Task <ActionResult <SanPham_DienThoai> > PostSanPham_DienThoai(SanPham_DienThoai sanPham_DienThoai) { _context.sanPham_DienThoais.Add(sanPham_DienThoai); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSanPham_DienThoai", new { id = sanPham_DienThoai.MaDT }, sanPham_DienThoai)); }
public async Task <IActionResult> PutSanPham_DienThoai(int id, SanPham_DienThoai sanPham_DienThoai) { if (id != sanPham_DienThoai.MaDT) { return(BadRequest()); } _context.Entry(sanPham_DienThoai).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SanPham_DienThoaiExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }