public IActionResult Put(int id, Targetskp data) { using (var db = new OcphDbContext(this._dbsetting)) { var result = db.TargetSKP.Update(x => new { x.biaya, x.idskp, x.kegiatan, x.kualitas, x.kuantitas, x.waktu }, data, x => x.idtargetskp == id); return(Ok(result)); } }
public IActionResult Post(Targetskp data) { using (var db = new OcphDbContext(this._dbsetting)) { var resultId = db.TargetSKP.InsertAndGetLastID(data); if (resultId > 0) { data.idtargetskp = resultId; } return(Ok(data)); } }
public IActionResult Put(int id, Targetskp data) { try { using (var db = new OcphDbContext(this._dbsetting)) { var result = db.Kegiatan.Update(x => new { x.kegiatan, x.kuantitas, x.kualitas, x.waktu, x.biaya }, data, x => x.idtargetskp == id); if (result) { return(Ok(result)); } throw new System.Exception("Data Tidak Berhasil Diubah"); } } catch (System.Exception ex) { return(BadRequest(ex.Message)); } }