public IHttpActionResult PutHT_NHIEM_VU_PHONG_BAN(int id, HT_NHIEM_VU_PHONG_BAN hT_NHIEM_VU_PHONG_BAN) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != hT_NHIEM_VU_PHONG_BAN.ID) { return(BadRequest()); } db.Entry(hT_NHIEM_VU_PHONG_BAN).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HT_NHIEM_VU_PHONG_BANExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetHT_NHIEM_VU_PHONG_BAN(int id) { HT_NHIEM_VU_PHONG_BAN hT_NHIEM_VU_PHONG_BAN = db.HT_NHIEM_VU_PHONG_BAN.Find(id); if (hT_NHIEM_VU_PHONG_BAN == null) { return(NotFound()); } return(Ok(hT_NHIEM_VU_PHONG_BAN)); }
public IHttpActionResult PostHT_NHIEM_VU_PHONG_BAN(HT_NHIEM_VU_PHONG_BAN hT_NHIEM_VU_PHONG_BAN) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.HT_NHIEM_VU_PHONG_BAN.Add(hT_NHIEM_VU_PHONG_BAN); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = hT_NHIEM_VU_PHONG_BAN.ID }, hT_NHIEM_VU_PHONG_BAN)); }
public IHttpActionResult DeleteHT_NHIEM_VU_PHONG_BAN(int id) { HT_NHIEM_VU_PHONG_BAN hT_NHIEM_VU_PHONG_BAN = db.HT_NHIEM_VU_PHONG_BAN.Find(id); if (hT_NHIEM_VU_PHONG_BAN == null) { return(NotFound()); } db.HT_NHIEM_VU_PHONG_BAN.Remove(hT_NHIEM_VU_PHONG_BAN); db.SaveChanges(); return(Ok(hT_NHIEM_VU_PHONG_BAN)); }
public IHttpActionResult PostHT_THONG_BAO_MARKETING(MKGiaoViec giaoviec) { HT_CONG_VIEC_NHAN_VIEN congviecnv = new HT_CONG_VIEC_NHAN_VIEN(); congviecnv.NGAY_CAP_NHAT = DateTime.Today.Date; congviecnv.USERNAME = giaoviec.USERNAME; congviecnv.NGUOI_CAP_NHAT = giaoviec.NGUOI_CAP_NHAT; congviecnv.NHIEM_VU_CHI_TIET = giaoviec.NHIEM_VU_CHI_TIET; congviecnv.MUC_TIEU_CONG_VIEC = giaoviec.MUC_TIEU_CONG_VIEC; db.HT_CONG_VIEC_NHAN_VIEN.Add(congviecnv); db.SaveChanges(); HT_NHIEM_VU_PHONG_BAN nvphongban = new HT_NHIEM_VU_PHONG_BAN(); nvphongban.NGAY_CAP_NHAT = DateTime.Today.Date; nvphongban.MA_PHONG_BAN = giaoviec.MA_PHONG_BAN; nvphongban.NGUOI_CAP_NHAT = giaoviec.NGUOI_CAP_NHAT; nvphongban.NHIEM_VU_PHAI_LAM = giaoviec.NHIEM_VU_PHAI_LAM; db.HT_NHIEM_VU_PHONG_BAN.Add(nvphongban); db.SaveChanges(); HT_THONG_BAO_MARKETING thongbaomk = new HT_THONG_BAO_MARKETING(); thongbaomk.NGAY_THONG_BAO = DateTime.Today.Date; thongbaomk.MA_PHONG_BAN = giaoviec.MA_PHONG_BAN_MARK; thongbaomk.NGUOI_THONG_BAO = giaoviec.NGUOI_CAP_NHAT; thongbaomk.NOI_DUNG = giaoviec.NOI_DUNG_MARK; db.HT_THONG_BAO_MARKETING.Add(thongbaomk); db.SaveChanges(); HT_THONG_BAO_MARKETING thongbaomk1 = new HT_THONG_BAO_MARKETING(); thongbaomk1.NGAY_THONG_BAO = DateTime.Today.Date; thongbaomk1.MA_PHONG_BAN = giaoviec.MA_PHONG_BAN_SALE; thongbaomk1.NGUOI_THONG_BAO = giaoviec.NGUOI_CAP_NHAT; thongbaomk1.NOI_DUNG = giaoviec.NOI_DUNG_MARK; db.HT_THONG_BAO_MARKETING.Add(thongbaomk1); db.SaveChanges(); return(Ok()); }