Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        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());
        }
Exemplo n.º 3
0
        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);
        }