Ejemplo n.º 1
0
        public IActionResult CreateUri(int clientId, UriViewModel uri)
        {
            if (!ModelState.IsValid)
            {
                var viewModel = ViewModelBuilder.BuildCreateUriViewModel(ModelState, clientId, uri);

                return(View(viewModel));
            }

            var uriModel = Mapper.Map <UriModel>(uri);

            var result = m_uriManager.CreateUriForClient(clientId, uriModel);

            if (result.HasError)
            {
                ModelState.AddModelError(result.Error.Message);

                var viewModel = ViewModelBuilder.BuildCreateUriViewModel(ModelState, clientId);

                return(View(viewModel));
            }

            return(RedirectToAction(nameof(Uris), new { clientId }));
        }
Ejemplo n.º 2
0
        public IActionResult CreateUri(int clientId)
        {
            var viewModel = ViewModelBuilder.BuildCreateUriViewModel(ModelState, clientId);

            return(View(viewModel));
        }