コード例 #1
0
ファイル: PegawaiController.cs プロジェクト: egip/Sample-API
 // PUT: api/Pegawai/5
 /// <summary>
 /// Update Pegawai NIP in URL
 /// </summary>
 /// <param name="id"></param>
 /// <param name="mssgPegawai"></param>
 /// <returns></returns>
 public IHttpActionResult Put(string id, Pegawai mssgPegawai)
 {
     try
     {
         pegawaiDal.Update(mssgPegawai);
         return(Ok($"data pegawai {mssgPegawai.nama} berhasil di Update"));
     }
     catch (Exception ex)
     {
         return(BadRequest($"error : {ex.Message}"));
     }
 }
コード例 #2
0
 /// <summary>
 /// EDIT data Pegawai :: PUT : http://dennylabs.azurewebsites.net/api/Pegawai
 /// </summary>
 /// <param name="id"></param>
 /// <param name="dataPegawai"></param>
 /// <returns></returns>
 public IHttpActionResult Put(Pegawai dataPegawai)
 {
     try
     {
         pegawaiDAL.Update(dataPegawai);
         return(Ok("Data Pegawai: " + dataPegawai.Nama.ToUpper() + " berhasil diedit"));
     }
     catch (Exception ee)
     {
         return(BadRequest("Data Pegawai: " + dataPegawai.Nama.ToUpper() + " gagal diedit : " + ee.Message));
     }
 }
コード例 #3
0
 // PUT: api/Pegawai/5
 public IHttpActionResult Put(Pegawai pegawai)
 {
     try
     {
         pegawaiDAL.Update(pegawai);
         return(Ok($"Berhasil update data pegawai {pegawai.Nip}"));
     }
     catch (Exception ex)
     {
         return(BadRequest($"Error: {ex.Message}"));
     }
 }