public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            AppSettingsCustom = await _appSettingsCustomRepository.AddAsync(AppSettingsCustom);

            return(RedirectToPage("./Index"));
        }
        public async Task UpdateAsync(AppSettingsCustomEntity entity)
        {
            _dbContext.Entry(entity).State = EntityState.Modified;
            await _dbContext.SaveChangesAsync().ConfigureAwait(false);

            var isDefault = entity.Default;

            if (isDefault)
            {
                await ClearDefaultAsync(entity.Id).ConfigureAwait(false);
            }
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            AppSettingsCustom = await _appSettingsCustomRepository.GetByIdAsync(id.Value);

            if (AppSettingsCustom == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task <AppSettingsCustomEntity> AddAsync(AppSettingsCustomEntity entity)
        {
            var isDefault = entity.Default;

            if (isDefault)
            {
                await ClearDefaultAsync(entity.Id);
            }
            entity.Default = isDefault;
            _dbContext.AppSettingsCustomItems.Add(entity);
            await _dbContext.SaveChangesAsync().ConfigureAwait(false);

            return(entity);
        }
 public async Task DeleteAsync(AppSettingsCustomEntity entity)
 {
     _dbContext.AppSettingsCustomItems.Remove(entity);
     await _dbContext.SaveChangesAsync().ConfigureAwait(false);
 }
 public IActionResult OnGet()
 {
     AppSettingsCustom = new AppSettingsCustomEntity();
     return(Page());
 }