Beispiel #1
0
        public async Task <ActionResult> BeginDelistingCurrency(UpdateListingStatusModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("DelistCurrencyModal", model));
            }

            if (model.DelistOn == null)
            {
                ModelState.AddModelError(nameof(model.DelistOn), "A delist date is required");
                return(View("DelistCurrencyModal", model));
            }

            var isAuthenticated = await CryptopiaAuthenticationHelper.VerifyTwoFactorCode(AuthenticatedFeatureType.Delisting, model.TwoFactorCode);

            if (!isAuthenticated)
            {
                ModelState.AddModelError(nameof(model.TwoFactorCode), "Invalid code");
                return(View("DelistCurrencyModal", model));
            }

            var result = await AdminCurrencyWriter.BeginDelistingCurrency(User.Identity.GetUserId(), model);

            if (!ModelState.IsWriterResultValid(result))
            {
                return(View("DelistCurrencyModal", model));
            }

            return(CloseModalSuccess(result.Message));
        }
Beispiel #2
0
        public async Task <ActionResult> UpdateCurrency(UpdateCurrencyModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("UpdateCurrencyModal", model));
            }

            var result = await AdminCurrencyWriter.UpdateCurrency(User.Identity.GetUserId(), model);

            if (!ModelState.IsWriterResultValid(result))
            {
                return(View("UpdateCurrencyModal", model));
            }

            return(CloseModalSuccess(result.Message));
        }