public async Task <IActionResult> GetById(string id) { var sinhVien = await _sinhVienService.GetById(id); if (sinhVien == null) { return(BadRequest("Not found")); } return(Ok(sinhVien)); }
public HttpResponseMessage Put(FormDataCollection form) { var key = Convert.ToInt32(form.Get("key")); var values = form.Get("values"); var sinhVien = _sinhVienService.GetById(key); JsonConvert.PopulateObject(values, sinhVien); if (_sinhVienService.Update(sinhVien)) { return(Request.CreateResponse(HttpStatusCode.OK)); } return(Request.CreateResponse("Không thể cập nhật")); }