public async Task <IActionResult> Edit(string id, [Bind("CbMa,CbHoten,CbGioitinh,CbDiachi,CbNgaysinh,CbCmnd,CoquanCqMa,KyluatcbKlcbMa,KhenthuongcbKtcbMa")] Canbo canbo) { if (id != canbo.CbMa) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(canbo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CanboExists(canbo.CbMa)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CoquanCqMa"] = new SelectList(_context.Coquan, "CqMa", "CqMa", canbo.CoquanCqMa); ViewData["KhenthuongcbKtcbMa"] = new SelectList(_context.Khenthuongcb, "KtcbMa", "KtcbMa", canbo.KhenthuongcbKtcbMa); ViewData["KyluatcbKlcbMa"] = new SelectList(_context.Kyluatcb, "KlcbMa", "KlcbMa", canbo.KyluatcbKlcbMa); return(View(canbo)); }
public async Task <IActionResult> Create([Bind("CbMa,CbHoten,CbGioitinh,CbDiachi,CbNgaysinh,CbCmnd,CoquanCqMa,KyluatcbKlcbMa,KhenthuongcbKtcbMa")] Canbo canbo) { if (ModelState.IsValid) { _context.Add(canbo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CoquanCqMa"] = new SelectList(_context.Coquan, "CqMa", "CqMa", canbo.CoquanCqMa); ViewData["KhenthuongcbKtcbMa"] = new SelectList(_context.Khenthuongcb, "KtcbMa", "KtcbMa", canbo.KhenthuongcbKtcbMa); ViewData["KyluatcbKlcbMa"] = new SelectList(_context.Kyluatcb, "KlcbMa", "KlcbMa", canbo.KyluatcbKlcbMa); return(View(canbo)); }
private void LayDuLieuTT() { canbo = new Canbo(); canbo.Macanbo = txtMaso.Text; canbo.Tencanbo = txtHoten.Text; if (radNam.Checked) { canbo.Gioitinh = 1; } else { canbo.Gioitinh = 0; } canbo.Ngaysinh = dpkNgaySinh.Value; canbo.Chucvu = txtChucvu.Text; canbo.Diachi = txtDiachi.Text; canbo.Sdt = txtSDT.Text; canbo.Email = txtEmail.Text; canbo.Quyenhan = cboQuyenhan.Text; }
private void LayDuLieuTT() { canbo = new Canbo(); canbo.Macanbo = txtMaso.Text; canbo.Tencanbo = txtHoten.Text; if (radioGT.SelectedIndex == 0) { canbo.Gioitinh = 1; } else { canbo.Gioitinh = 0; } canbo.Ngaysinh = Convert.ToDateTime(dpkNgaySinh.EditValue); canbo.Chucvu = txtChucvu.Text; canbo.Diachi = txtDiachi.Text; canbo.Sdt = txtSDT.Text; canbo.Email = txtEmail.Text; canbo.Quyenhan = "Tạm khóa"; }