public IActionResult ChangeChoNgoi(long idchange, long idhientai, long mave)
        {
            var ve = _context.Ves.Find(mave);

            if (ve == null)
            {
                return(NotFound());
            }
            ve.MaChoNgoi = idchange;

            var chongoihientai = _context.ChoNgois.Find(idhientai);

            if (chongoihientai == null)
            {
                return(NotFound());
            }
            chongoihientai.TinhTrang = 0;

            var chongoimoi = _context.ChoNgois.Find(idchange);

            if (chongoimoi == null)
            {
                return(NotFound());
            }
            chongoimoi.TinhTrang = 1;

            _context.Update(ve);
            _context.Update(chongoihientai);
            _context.Update(chongoimoi);
            _context.SaveChanges();

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Edit(long id, [Bind("UserID,SDT,MatKhau,Email,HoTen,GioiTinh,DiaChi,NgaySinh,Avatar,CreatedTime,UpdateTime")] NguoiDung nguoiDung)
        {
            if (id != nguoiDung.UserID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    nguoiDung.UpdateTime = DateTime.Now;
                    _context.Update(nguoiDung);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NguoiDungExists(nguoiDung.UserID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(nguoiDung));
        }
Пример #3
0
 public IActionResult Edit(DieuHanh dieuHanh)
 {
     dieuHanh.NgayKhoiHanh = dieuHanh.NgayKhoiHanh.Date;
     dieuHanh.UpdateTime   = DateTime.Now;
     _context.Update(dieuHanh);
     _context.SaveChanges();
     return(RedirectToAction("Index"));
 }
Пример #4
0
        public IActionResult Edit(TuyenXe tuyenXe)
        {
            tuyenXe.UpdateTime = DateTime.Now;

            _context.Update(tuyenXe);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public IActionResult Edit(Xe xe)
 {
     _context.Update(xe);
     _context.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public IActionResult Edit(Admins admin)
 {
     _context.Update(admin);
     _context.SaveChanges();
     return(RedirectToAction("Index"));
 }