Beispiel #1
0
        public IHttpActionResult PutAuthor(int id, Author author)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != author.AuthorID)
            {
                return(BadRequest());
            }

            db.Entry(author).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AuthorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutBicyclette(int id, Bicyclette bicyclette)
        {
            if (id != bicyclette.bicycletteId)
            {
                return(BadRequest());
            }

            db.Entry(bicyclette).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BicycletteExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #3
0
        public IHttpActionResult PutBook(string id, Book book)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != book.BookISBN)
            {
                return(BadRequest());
            }

            db.Entry(book).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BookExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #4
0
        public IHttpActionResult PutStudent(string id, Student student)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != student.StudentId)
            {
                return(BadRequest());
            }

            db.Entry(student).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StudentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public ActionResult Edit([Bind(Include = "MaPhieuNhap,NgayTao,MaNCC")] PhieuNhap phieuNhap)
 {
     if (ModelState.IsValid)
     {
         db.Entry(phieuNhap).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(phieuNhap));
 }
 public ActionResult Edit([Bind(Include = "MaKhachHang,TenKhachHang,SoDienThoai")] KhachHang khachHang)
 {
     if (ModelState.IsValid)
     {
         db.Entry(khachHang).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(khachHang));
 }
 public ActionResult Edit([Bind(Include = "STT,MaPhieuXuat,MaHangHoa,SoLuong,NgayXuat,MaKhachHang")] chitietxuat chitietxuat)
 {
     if (ModelState.IsValid)
     {
         db.Entry(chitietxuat).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(chitietxuat));
 }
 public ActionResult Edit([Bind(Include = "STT,MaPhieuNhap,MaHangHoa,SoLuong,NgayNhap,MaNCC")] chitietnhap chitietnhap)
 {
     if (ModelState.IsValid)
     {
         db.Entry(chitietnhap).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(chitietnhap));
 }
 public ActionResult Edit([Bind(Include = "STT,MaHangHoa,SoNhap,SoXuat,SoTon")] NhapXuatTon nhapXuatTon)
 {
     if (ModelState.IsValid)
     {
         db.Entry(nhapXuatTon).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(nhapXuatTon));
 }
 public ActionResult Edit([Bind(Include = "MaHangHoa,TenHangHoa,DonGia,DonViTinh,MaNCC")] Hanghoa hanghoa)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hanghoa).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(hanghoa));
 }
Beispiel #11
0
 public ActionResult Edit([Bind(Include = "MaNCC,TenNCC,SoDien_Thoai")] NhaCC nhaCC)
 {
     if (ModelState.IsValid)
     {
         db.Entry(nhaCC).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(nhaCC));
 }
 public ActionResult Edit([Bind(Include = "PhieuNhapXuat,NgayTao,MaKhachHang")] PhieuXuat phieuXuat)
 {
     if (ModelState.IsValid)
     {
         db.Entry(phieuXuat).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(phieuXuat));
 }