Example #1
0
        public async Task <ActionResult> ViewVoteItem(int voteItemId)
        {
            var model = await VoteReader.GetVoteItem(voteItemId);

            if (model == null)
            {
                return(ViewMessageModal(ViewMessageModel.Error("Not Found!", "VoteItem not found.")));
            }

            return(View("ViewVoteItemModal", model));
        }
Example #2
0
        public async Task <ActionResult> AdminUpdateVoteItem(int voteItemId)
        {
            var model = await VoteReader.AdminGetVoteItem(voteItemId);

            if (model == null)
            {
                return(ViewMessageModal(ViewMessageModel.Error("Not Found", "VoteItem {0} not found.", voteItemId)));
            }

            return(View("AdminUpdateVoteItemModal", model));
        }
Example #3
0
        public async Task <ActionResult> AdminUpdateTicketStatus(int ticketId, SupportTicketStatus status)
        {
            var result = await SupportWriter.UpdateSupportTicketStatus(User.Id(), new UpdateSupportTicketStatusModel
            {
                TicketId = ticketId,
                Status   = status
            });

            if (result.HasErrors)
            {
                return(ViewMessage(ViewMessageModel.Error("Error", result.FlattenErrors)));
            }

            return(RedirectToAction("AdminViewTicket", new { ticketId = ticketId }));
        }
Example #4
0
        public async Task <ActionResult> CloseTicket(int ticketId)
        {
            var result = await SupportWriter.UpdateSupportTicketStatus(User.Id(), new UpdateSupportTicketStatusModel
            {
                TicketId = ticketId,
                Status   = SupportTicketStatus.UserClosed
            });

            if (result.HasErrors)
            {
                return(ViewMessage(ViewMessageModel.Error("Error", result.FirstError)));
            }

            return(RedirectToAction("ViewTicket", new { ticketId = ticketId }));
        }
Example #5
0
        public async Task <ActionResult> AdminUpdateCategory(int categoryId)
        {
            var category = await SupportReader.AdminGetSupportCategory(categoryId);

            if (category == null)
            {
                return(ViewMessageModal(ViewMessageModel.Error("Not Found", "Category with id {0} not found", categoryId)));
            }

            return(View("AdminUpdateCategoryModal", new UpdateSupportCategoryModel
            {
                Id = category.Id,
                Name = category.Name,
                IsEnabled = category.IsEnabled
            }));
        }
Example #6
0
        public async Task <ActionResult> AdminUpdateFaq(int faqId)
        {
            var faq = await SupportReader.AdminGetSupportFaq(faqId);

            if (faq == null)
            {
                return(ViewMessageModal(ViewMessageModel.Error("Not Found", "FAQ with id {0} not found", faqId)));
            }

            return(View("AdminUpdateFaqModal", new UpdateSupportFaqModel
            {
                Id = faq.Id,
                Question = faq.Question,
                Answer = faq.Answer,
                Order = faq.Order,
                IsEnabled = faq.IsEnabled
            }));
        }
Example #7
0
        public async Task <ActionResult> Update(int tradePairId)
        {
            var user = await UserManager.FindByIdAsync(User.Id());

            if (user == null)
            {
                return(Unauthorized());
            }

            var model = await TradePairReader.GetTradePairUpdate(tradePairId);

            if (model == null)
            {
                return(ViewMessageModal(ViewMessageModel.Error("Not Found!", "TradePair '{0}' not found.", tradePairId)));
            }

            return(View("UpdateTradePairModal", model));
        }
        public async Task <ActionResult> Update(int currencyId)
        {
            var user = await UserManager.FindByIdAsync(User.Id());

            if (user == null)
            {
                return(Unauthorized());
            }

            var model = await CurrencyReader.GetCurrencyUpdate(currencyId);

            if (model == null)
            {
                return(ViewMessageModal(ViewMessageModel.Error("Not Found!", "Currency '{0}' not found.", currencyId)));
            }

            return(View("UpdateCurrencyModal", model));
        }
Example #9
0
        public async Task <ActionResult> AdminUpdateVoteSettings()
        {
            var model = await VoteReader.GetVoteSettings();

            if (model == null)
            {
                return(ViewMessageModal(ViewMessageModel.Error("Not Found", "Vote settings not found.")));
            }

            return(View("AdminUpdateVoteSettingsModal", new UpdateVoteSettingsModel
            {
                Next = model.NextVote,
                Price = model.Price,
                IsFreeEnabled = model.IsFreeEnabled,
                IsPaidEnabled = model.IsPaidEnabled,
                CurrencyId = model.CurrencyId,
                Currencies = await CurrencyReader.GetCurrencies()
            }));
        }
Example #10
0
        public async Task <ActionResult> CreatePaidVote(int voteItemId, string voteItem)
        {
            var user = await UserManager.FindByIdAsync(User.Id());

            if (user == null)
            {
                return(UnauthorizedModal());
            }

            var voteSettings = await VoteReader.GetVoteSettings();

            if (voteSettings == null)
            {
                return(ViewMessageModal(ViewMessageModel.Error("Invalid Request", "An unknown error occured.")));
            }

            var balance = await BalanceReader.GetBalance(User.Id(), voteSettings.CurrencyId);

            if (balance == null)
            {
                return(ViewMessageModal(ViewMessageModel.Error("Invalid Request", "An unknown error occured.")));
            }

            var model = new CreatePaidVoteModel
            {
                VoteItemId             = voteItemId,
                VoteItem               = voteItem,
                Price                  = voteSettings.Price,
                Balance                = balance.Avaliable,
                Symbol                 = balance.Symbol,
                TwoFactorComponentType = TwoFactorComponentType.Transfer,
                TwoFactorType          = await UserManager.GetUserTwoFactorTypeAsync(user.Id, TwoFactorComponentType.Transfer)
            };

            return(View("CreatePaidVoteModal", model));
        }