public async Task <IActionResult> Edit(int id, [Bind("ThamNienID,ThamNienLam,Luong")] ThamNien thamNien)
        {
            if (id != thamNien.ThamNienID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(thamNien);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ThamNienExists(thamNien.ThamNienID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(thamNien));
        }
Exemple #2
0
        public async Task Update(ThamNien thamnien)
        {
            ThamNien newthamnien = await newContext.ThamNien.FindAsync(thamnien.ThamNienID);

            newthamnien = thamnien;
            await newContext.SaveChangesAsync();
        }
Exemple #3
0
        public async Task Remove(int ID)
        {
            ThamNien thamnien = await newContext.ThamNien.FindAsync(ID);

            newContext.Remove(thamnien);
            await newContext.SaveChangesAsync();
        }
        public async Task <IActionResult> Create([Bind("ThamNienID,ThamNienLam,Luong")] ThamNien thamNien)
        {
            if (ModelState.IsValid)
            {
                _context.Add(thamNien);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(thamNien));
        }
Exemple #5
0
        public bool Exit(int ID)
        {
            ThamNien thamnien = newContext.ThamNien.Find(ID);

            if (thamnien != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #6
0
 public override string ToString()
 {
     return(string.Format("GV{0} - {1} - Học vị {2} - Thâm niên {3} năm", MaGV.ToString(), TenGV, HocVi, ThamNien.ToString()));
 }
Exemple #7
0
        public async Task <ThamNien> FindById(int ID)
        {
            ThamNien thamnien = await newContext.ThamNien.FindAsync(ID);

            return(thamnien);
        }
Exemple #8
0
 public async Task Add(ThamNien thamnien)
 {
     newContext.Add(thamnien);
     await newContext.SaveChangesAsync();
 }