public async Task <IActionResult> Modify(User model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            _context.Entry(model).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Info), new { user_no = model.User_no }));
        }
Example #2
0
        public async Task <IActionResult> Delete(string userName)
        {
            var admin = await _context.Admin
                        .SingleOrDefaultAsync(m => m.UserName == userName);

            _context.Admin.Remove(admin);
            await _context.SaveChangesAsync();

            if (admin == null)
            {
                return(NotFound());
            }

            return(Ok());
        }
        public async Task <IActionResult> AddDVD(Dvd_info model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            model.Create_date = DateTime.Now;

            _context.Entry(model).State = EntityState.Added;
            await _context.SaveChangesAsync();

            var lastDvdCode = _context.Dvd_info.LastOrDefault().Movie_code;

            _context.Dvd_recode.Add(
                new Dvd_recode {
                Movie_code = lastDvdCode,
                Status     = 0,
            });

            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Details)));
        }