public IActionResult Post([FromBody] Mhs value) { MhsRepo mhs = new MhsRepo(); var feedback = mhs.insert(value); return(Ok(feedback)); }
public IActionResult Put([FromBody] Mhs value) { MhsRepo mhs = new MhsRepo(); if (mhs.update(value) == true) { return(Ok(value)); } else { var response = new ContentResult() { StatusCode = StatusCodes.Status404NotFound, }; return(response); } }
public IActionResult Get(int id) { MhsRepo mhs = new MhsRepo(); var hasil = mhs.getById(id); if (hasil == null) { var response = new ContentResult() { StatusCode = StatusCodes.Status204NoContent, }; return(response); } else { return(Ok(hasil)); } }
public IActionResult Get() { MhsRepo mhs = new MhsRepo(); var listMhs = mhs.getAll(); if (listMhs == null) { var response = new ContentResult() { StatusCode = StatusCodes.Status204NoContent, }; return(response); } else { return(Ok(listMhs)); } }
public IActionResult Delete(int id) { MhsRepo mhs = new MhsRepo(); Mhs mh = new Mhs(); mh.Id = id; if (mhs.delete(mh) == true) { return(Ok(mh)); } else { var response = new ContentResult() { StatusCode = StatusCodes.Status404NotFound, }; return(response); } }