Example #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (ModelState.IsValid)
            {
                var result = await currencyLogic.AddCurrencyAsync(CurrencyName);

                if (result)
                {
                    return(RedirectToPage("/Admin/CurrencyCreated", "CurrencyCreated"));
                }
                ModelState.AddModelError("CurrencyName", "This currency name is already in use");

                return(Page());
            }

            return(BadRequest());
        }