public ActionResult Update([FromBody] NguoiDung c) { try { if (ModelState.IsValid) { nguoidungRepo.Update(c); return(Json(c)); } } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); } return(View(c)); }
private void btnXoaHS_Click(object sender, EventArgs e) { string oldHS = dgvHocSinh.SelectedRows[0].Cells["MaHS"].Value.ToString(); HocSinh hs = _hocSinhRepository.FindByCondition(p => p.MaHS.Equals(oldHS)).Single(); int nguoiDungID = hs.NguoiDungID; _hocSinhRepository.Delete(hs); _hocSinhRepository.Update(); NguoiDung nguoiDung = _nguoiDungRepository.FindByCondition(p => p.IDNguoiDung.Equals(nguoiDungID)).Single(); _nguoiDungRepository.Delete(nguoiDung); _nguoiDungRepository.Update(); LoadHocSinh(); }