예제 #1
0
        public async Task <IActionResult> Confilm([Bind("ConfilmDate")] ConfilmViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Index"));
            }
            if (!TempData.ContainsKey("member") || !TempData.ContainsKey("confilmDate"))
            {
                return(RedirectToAction("Index"));
            }
            if (TempData["confilmDate"].ToString() != viewModel.ConfilmDate)
            {
                return(RedirectToAction("Index"));
            }
            var member = JsonConvert.DeserializeObject <Member>(TempData["member"].ToString());

            using (var point = new BizLogic.Point(member.Twitter, member.Name, member.Office, member.RepeatCount))
            {
                member.SkillPoint  = point.GetSkillPoint();
                member.FamousPoint = point.GetFamousPoint();
            }
            member.ApplicationDate = DateTime.Now;
            _context.Add(member);
            await _context.SaveChangesAsync();

            return(RedirectToAction("Thanks"));
        }
        public JsonResult GetPoint(string twitter, string name, string office, int repeatCount)
        {
            int skill;
            int famous;

            using (var point = new BizLogic.Point(twitter, name, office, repeatCount))
            {
                skill  = point.GetSkillPoint();
                famous = point.GetFamousPoint();
            }
            return(Json(new { skillpoint = skill, famouspoint = famous }));
        }