コード例 #1
0
        public ActionResult StepFiveProcess(StepFiveViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("StepFive", model));
            }

            return(RedirectToAction("Success"));
        }
コード例 #2
0
        public ActionResult stepFive(StepFiveViewModel model)
        {
            if (model.OpposedAuthorsEmails != null && model.OpposedAuthorsEmails.GroupBy(a => a).Any(c => c.Count() > 1))
            {
                ModelState.AddModelError("", "Same User Repeated");
            }
            if (!ModelState.IsValid)
            {
                model.OpposedAuthorsInstitutions = initializeUsersInstitutions(model.OpposedAuthorsEmails.ToList());
                return(View(model));
            }
            string OpposedAuthorsEmails = "";

            if (model.OpposedAuthorsEmails != null)
            {
                foreach (var authorEmail in model.OpposedAuthorsEmails)
                {
                    OpposedAuthorsEmails += authorEmail + "-;";
                }
            }

            if (HttpContext.Session.GetInt32("articleId") != null)
            {
                int id = (int)HttpContext.Session.GetInt32("articleId");

                TempArticle article = dbContext.tempArticles.SingleOrDefault(ta => ta.Id == id);
                article.OpposedAuthorsEmails = OpposedAuthorsEmails;

                dbContext.SaveChanges();
            }
            else
            {
                TempArticle article = new TempArticle()
                {
                    OpposedAuthorsEmails = OpposedAuthorsEmails
                };
                dbContext.tempArticles.Add(article);
                dbContext.SaveChanges();
                HttpContext.Session.SetInt32("articleId", article.Id);
            }
            return(RedirectToAction("stepSix"));
        }
コード例 #3
0
        public ActionResult stepFive()
        {
            if (HttpContext.Session.GetInt32("articleId") != null)
            {
                int id = (int)HttpContext.Session.GetInt32("articleId");

                TempArticle tempArticle = dbContext.tempArticles.SingleOrDefault(ta => ta.Id == id);

                StepFiveViewModel model = _mapper.Map <TempArticle, StepFiveViewModel>(tempArticle);
                model.OpposedAuthorsEmails = decodeStringToList(tempArticle.OpposedAuthorsEmails);

                model.OpposedAuthorsInstitutions = new List <string>();
                foreach (string email in model.OpposedAuthorsEmails)
                {
                    var result = dbContext.Users.Include(u => u.institution).SingleOrDefault(u => u.Email == email);
                    model.OpposedAuthorsInstitutions.Add(result.institution.Name);
                }
                return(View(model));
            }

            return(View());
        }
コード例 #4
0
        public ActionResult StepFive()
        {
            var userEmail    = Request.QueryString["email"];
            var date         = Request.QueryString["dt"].Split('|')[0];
            var time         = Request.QueryString["dt"].Split('|')[1];
            var linkDateTime = DateTime.Parse(date + " " + time).AddMinutes(5); // Link Expire after 5 Mins
            var nowTime      = DateTime.Now;

            var viewModel = new StepFiveViewModel()
            {
                EthPrice  = _context.SetPrices.FirstOrDefault(x => x.Status == true).Price,
                MinEthBuy = _context.EthPurchaseRange.FirstOrDefault().Min,
                MaxEthBuy = _context.EthPurchaseRange.FirstOrDefault().Max
            };

            if (linkDateTime > nowTime)
            {
                return(View(viewModel));
            }
            else
            {
                return(Content("Payment Link has been Expired."));
            }
        }