public IActionResult Add()
        {
            BAO_CAO_CONG_NO khachHangVMD = new BAO_CAO_CONG_NO();

            ViewData["MaKhachHang"] = new SelectList(_database.KHACH_HANG.ToList(), "MaKH", "TenKH");
            return(View(khachHangVMD));
        }
        public IActionResult Edit(int id, BAO_CAO_CONG_NO bcnoVM)
        {
            var bcNo = _database.BAO_CAO_CONG_NO.FirstOrDefault(k => k.MaBCN == id);

            bcNo.Thang    = bcnoVM.Thang;
            bcNo.NoDau    = bcnoVM.NoCuoi;
            bcNo.NoCuoi   = bcnoVM.NoCuoi;
            bcNo.PhatSinh = bcnoVM.PhatSinh;
            _database.SaveChanges();
            return(RedirectToAction("Index", "BaoCaoNo"));
        }
        public IActionResult Edit(int id)
        {
            var             bcNo          = _database.BAO_CAO_CONG_NO.FirstOrDefault(ch => ch.MaBCN == id);
            BAO_CAO_CONG_NO bcNoViewModel = new BAO_CAO_CONG_NO()
            {
                Thang    = bcNo.Thang,
                NoDau    = bcNo.NoDau,
                NoCuoi   = bcNo.NoCuoi,
                PhatSinh = bcNo.PhatSinh,
            };

            return(View(bcNoViewModel));
        }
 public IActionResult Add(BAO_CAO_CONG_NO newbcNo)
 {
     if (ModelState.IsValid)
     {
         newbcNo.PhatSinh = newbcNo.NoDau - newbcNo.NoCuoi;
         _database.BAO_CAO_CONG_NO.Add(newbcNo);
         _database.SaveChanges();
         return(RedirectToAction("Index", "BaoCaoNo"));
     }
     else
     {
         return(View(newbcNo));
     }
 }