コード例 #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var exists = await _service.ExistsAsync("Nome", Station.Nome);

            if (exists)
            {
                return(BadRequest("O nome informado já existe!"));
            }

            await _service.InsertRegistryAsync(Station);

            return(RedirectToPage("./Index"));
        }