public IHttpActionResult PutNhanVien(int id, NhanVien nhanVien)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != nhanVien.MaNhanVien)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #2
0
 public bool ThemMoiSanPham(SanPham_OBJ obj)
 {
     try
     {
         db.SanPhams.Add(MapperBase(obj));
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #3
0
        public TaiKhoan_OBJ Xoa(string TenTaiKhoan)
        {
            MayTinhDbContext db = new MayTinhDbContext();

            Base.TaiKhoan item = db.TaiKhoans.Find(TenTaiKhoan);
            if (item == null)
            {
                return(null);
            }
            db.TaiKhoans.Remove(item);
            db.SaveChanges();
            return(Mapper(item));
        }
Example #4
0
        public LoaiSanPham_OBJ Xoa(int id)
        {
            MayTinhDbContext db = new MayTinhDbContext();

            Base.LoaiSanPham item = db.LoaiSanPhams.Find(id);
            if (item == null)
            {
                return(null);
            }
            db.LoaiSanPhams.Remove(item);
            db.SaveChanges();
            return(Mapper(item));
        }
Example #5
0
        public NhaSanXuat_OBJ Xoa(int id)
        {
            MayTinhDbContext db = new MayTinhDbContext();

            Base.NhaSanXuat item = db.NhaSanXuats.Find(id);
            if (item == null)
            {
                return(null);
            }
            db.NhaSanXuats.Remove(item);
            db.SaveChanges();
            return(Mapper(item));
        }
 public bool ThemMoi(ThongSoKyThuat_OBJ obj)
 {
     try
     {
         MayTinhDbContext db = new MayTinhDbContext();
         db.ThongSoKyThuats.Add(MapperBase(obj));
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #7
0
 public bool ThemMoi(LoaiSanPham_OBJ obj)
 {
     try
     {
         MayTinhDbContext db = new MayTinhDbContext();
         db.LoaiSanPhams.Add(MapperBase(obj));
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
 public bool CapNhap(ThongSoKyThuat_OBJ obj)
 {
     try
     {
         MayTinhDbContext    db   = new MayTinhDbContext();
         Base.ThongSoKyThuat item = MapperBase(obj);
         db.Entry(item).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        public ThongSoKyThuat_OBJ Xoa(int MaSanPham, int MaMay)
        {
            MayTinhDbContext db = new MayTinhDbContext();

            Base.ThongSoKyThuat item = (
                from items in db.ThongSoKyThuats
                where items.MaSanPham == MaSanPham && items.MaMay == MaMay
                select items).SingleOrDefault();

            if (item == null)
            {
                return(null);
            }
            db.ThongSoKyThuats.Remove(item);
            db.SaveChanges();
            return(Mapper(item));
        }
Example #10
0
 public int ThemMoiMotTaiKhoan(TaiKhoan taiKhoan)
 {
     MayTinhDbContext.TaiKhoans.Add(taiKhoan);
     MayTinhDbContext.SaveChanges();
     return(1);
 }