public async Task <IActionResult> PutTblRole(int id, TblRole tblRole)
        {
            if (id != tblRole.RoleId)
            {
                return(BadRequest());
            }

            _context.Entry(tblRole).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblRoleExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("RoleId,Role,Active,Discription,CreatedBy,CreatedDate")] TblRole tblRole)
        {
            if (ModelState.IsValid)
            {
                db.Add(tblRole);
                await db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblRole));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("UserId,Username,Password,Lock,RoleId,CreatedBy,CreatedDate")] TblUser tblUser)
        {
            if (ModelState.IsValid)
            {
                db.Add(tblUser);
                await db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblUser));
        }
        public async Task <IActionResult> PutTblFootballTeam(decimal id, TblFootballTeam tblFootballTeam)
        {
            if (id != tblFootballTeam.FootballTeamId)
            {
                return(BadRequest());
            }

            _context.Entry(tblFootballTeam).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblFootballTeamExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult <TblUser> > DeleteTblUser(decimal id)
        {
            var tblUser = await _context.TblUser.FindAsync(id);

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

            _context.TblUser.Remove(tblUser);
            await _context.SaveChangesAsync();

            return(tblUser);
        }