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)); }
public async Task <ActionResult> AdminViewRequest(int requestId) { var model = await SupportReader.AdminGetSupportRequest(requestId); if (model == null) { return(ViewMessage(ViewMessageModel.Warning("Not Found", "Support request #{0} not found.", requestId))); } return(View(model)); }
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)); }
public async Task <ActionResult> ViewTicket(int ticketId) { var model = await SupportReader.GetSupportTicket(User.Id(), ticketId, false); if (model == null) { return(ViewMessage(ViewMessageModel.Warning("Not Found", "Support ticket #{0} not found.", ticketId))); } return(View(model)); }
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 })); }
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 })); }
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 })); }
public async Task <ActionResult> SupportRequest(CreateSupportRequestModel model) { if (!ModelState.IsValid) { return(View("Index", model)); } var result = await SupportWriter.CreateSupportRequest(model); if (!ModelState.IsWriterResultValid(result)) { return(View("Index", model)); } return(ViewMessage(ViewMessageModel.Success("Success", "Successfully submitted support request, a support person will be in touch shortly."))); }
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)); }
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 })); }
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> 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() })); }
public async Task <ActionResult> PasswordForgot(PasswordForgotModel model) { if (!ModelState.IsValid) { return(View(model)); } var message = new ViewMessageModel(ViewMessageType.Info, "Reset Email Sent", "An email has been sent to your registered email address with password reset instructions."); var user = await UserManager.FindByEmailAsync(model.Email); if (user == null || !(await UserManager.IsEmailConfirmedAsync(user.Id)) || !user.IsEnabled) { // Don't reveal that the user does not exist or is not confirmed return(ViewMessage(message)); } var resetPasswordToken = Url.Action("PasswordReset", "Account", new { secureToken = await UserManager.GeneratePasswordResetTokenAsync(user.Id) }, protocol: Request.Url.Scheme); await EmailService.Send(EmailType.PasswordReset, user, Request.GetIPAddress(), new EmailParam("[RESETLINK]", resetPasswordToken)); return(ViewMessage(message)); }
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)); }
public async Task <ActionResult> ForgotPassword(ForgotPasswordViewModel model) { if (!CryptopiaAuthenticationHelper.ValidateCaptcha()) { ModelState.AddModelError("", Resources.Authorization.reCaptchaError); return(View(model)); } if (!ModelState.IsValid) { return(View(model)); } if (ModelState.IsValid) { var message = new ViewMessageModel(ViewMessageType.Info, Resources.Authorization.resetTitle, Resources.Authorization.resetMessage); var user = await UserManager.FindByEmailAsync(model.Email); if (user == null || !(await UserManager.IsEmailConfirmedAsync(user.Id)) || user.IsDisabled) { // Don't reveal that the user does not exist or is not confirmed return(ViewMessage(message)); } var resetPasswordToken = Url.Action("ResetPassword", "Login", new { code = await UserManager.GeneratePasswordResetTokenAsync(user.Id) }, protocol: Request.Url.Scheme); await SendEmailAsync(EmailTemplateType.PasswordReset, null, user.Email, user.Id, user.UserName, resetPasswordToken); return(ViewMessage(message)); } // If we got this far, something failed, redisplay form return(View(model)); }
protected PartialViewResult ViewMessagePartial(ViewMessageModel model) { return(PartialView("ViewMessagePartial", model)); }
public PartialViewResult PartialViewMessage(ViewMessageModel model) { return(PartialView("ViewMessage", model)); }
public ViewResult ViewMessageModal(ViewMessageModel model) { return(View("ViewMessageModal", model)); }
protected ViewResult ViewMessageModal(ViewMessageModel model) { return(View("ViewMessageModal", model)); }