public async Task <ActionResult <PerDetail1> > PostPerDetail1(PerDetail1 perDetail1)
        {
            _context.PerDetail1.Add(perDetail1);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPerDetail1", new { id = perDetail1.IdDetail }, perDetail1));
        }
        public async Task <IActionResult> PutPerDetail1(int id, PerDetail1 perDetail1)
        {
            if (id != perDetail1.IdDetail)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <ActionResult <PermissionDetailModel> > PostPermission(PermissionDetailModel permission)
        {
            Permission per = new Permission();

            per.NamePer = permission.NamePer;
            _context.Permission.Add(per);
            await _context.SaveChangesAsync();

            PerDetail1 pd = new PerDetail1();

            pd.IdPer      = per.IdPer;
            pd.CreateRole = permission.CreateRole;
            pd.EditByName = permission.EditByName;
            pd.EditFull   = permission.EditFull;
            pd.DeleteRole = permission.DeleteRole;

            return(CreatedAtAction("GetPermission", new { id = permission.IdPer }, permission));
        }