public async Task <IActionResult> Edit(InsertVm studentVm) { var result = await _studentService.EditAsync(studentVm.id, studentVm); ViewBag.Success = null; if (result) { ViewBag.Success = "Cập nhật sinh viên thành công."; } return(View()); }
public async Task <IActionResult> Insert(InsertVm studentVm) { var result = await _studentService.InsertAsync(studentVm); ViewBag.Success = null; if (result) { ViewBag.Success = "Thêm sinh viên thành công"; } return(View()); }
public async Task <bool> EditAsync(string studentId, InsertVm studentVm) { string requestUri = $"/students/{studentId}"; var httpContent = new StringContent(JsonConvert.SerializeObject(studentVm), Encoding.UTF8, "application/json"); var response = await _client.PutAsync(requestUri, httpContent); if (response.IsSuccessStatusCode) { return(true); } return(false); }