public IHttpActionResult PutDetailproduct(int id, Detailproduct detailproduct) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != detailproduct.DetailId) { return(BadRequest()); } db.Entry(detailproduct).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DetailproductExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private void listViewSanpham_ItemActivate(object sender, EventArgs e) { ListView senders = (ListView)sender; string ma = MaSP[senders.SelectedIndices[0]]; Detailproduct frm = new Detailproduct(ma); frm.ShowDialog(); }
public IHttpActionResult GetDetailproduct(int id) { Detailproduct detailproduct = db.Detailproducts.Find(id); if (detailproduct == null) { return(NotFound()); } return(Ok(detailproduct)); }
public IHttpActionResult PostDetailproduct(Detailproduct detailproduct) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Detailproducts.Add(detailproduct); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = detailproduct.DetailId }, detailproduct)); }
public IHttpActionResult DeleteDetailproduct(int id) { Detailproduct detailproduct = db.Detailproducts.Find(id); if (detailproduct == null) { return(NotFound()); } db.Detailproducts.Remove(detailproduct); db.SaveChanges(); return(Ok(detailproduct)); }
private void UserProduct_Load(object sender, EventArgs e) { string ten = "SP"; listViewSanpham.LargeImageList = imageSanPham; for (int index = 0; index < 10; index++) { ListViewItem sp = new ListViewItem("San pham " + index, 0); MaSP.Add(ten + index.ToString()); listViewSanpham.Items.Add(sp); } Detailproduct frm = new Detailproduct(); int i = listViewSanpham.Items.Count; }