Esempio n. 1
0
        public IActionResult Add(int id)
        {
            var viewmodel = new ClientPostLogoutRedirectUriAddViewModel
            {
                ClientId = id,
            };

            return(View(viewmodel));
        }
Esempio n. 2
0
        public async Task <IActionResult> Add(ClientPostLogoutRedirectUriAddViewModel viewmodel)
        {
            if (ModelState.IsValid)
            {
                var record = _mapper.Map <ClientPostLogoutRedirectUri>(viewmodel);
                record.Id = 0;
                _dbContext.ClientPostLogoutRedirectUris.Add(record);

                var result = await _dbContext.SaveChangesAsync().ConfigureAwait(false);

                if (result > 0)
                {
                    return(RedirectToAction("Details", "Clients", new { id = viewmodel.ClientId }));
                }

                ModelState.AddModelError("", "Failed");
            }

            return(View(viewmodel));
        }