Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        public IHttpActionResult GetDetailproduct(int id)
        {
            Detailproduct detailproduct = db.Detailproducts.Find(id);

            if (detailproduct == null)
            {
                return(NotFound());
            }

            return(Ok(detailproduct));
        }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
        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));
        }
Esempio n. 6
0
        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;
        }