Beispiel #1
0
        public JsonResult SaveNewStakeAsync(StakesViewModel IncStakeData)
        {
            // object userId = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
            //var user = await _userManager.GetUserAsync(User);
            bool Resp = false;
            // var email = user.Email;
            Helpers hlp;

            using (MyBetAppContext db = new MyBetAppContext())
            {
                TbStakes sT = new TbStakes
                {
                    // UserID = hlp.CurrentUser(),
                    TotalStakeAmount = IncStakeData.Stakes.TotalStakeAmount
                };
                db.TbStakes.Add(sT);
                db.SaveChanges();
                foreach (var item in IncStakeData.StakesDetails)
                {
                    item.StakeID = sT.StakeID;
                    db.TbStakeDetails.Add(item);
                }
                ;
                db.SaveChanges();
                Resp = true;
            }


            return(Json(new { Result = Resp }));
        }
        public JsonResult SaveNewStakeAsync(StakesViewModel IncStakeData)
        {
            bool Resp = false;

            TbStakes sT = new TbStakes
            {
                UserID           = User.Identity.Name,
                TotalStakeAmount = IncStakeData.Stakes.TotalStakeAmount
            };

            _context.TbStakes.Add(sT);
            _context.SaveChanges();
            foreach (var item in IncStakeData.StakesDetails)
            {
                item.StakeID = sT.StakeID;
                _context.TbStakeDetails.Add(item);
            }
            ;
            _context.SaveChanges();
            Resp = true;



            return(Json(new { Result = Resp }));
        }
 public Stakes EditOdd(StakesViewModel Svm, int Id)
 {
     throw new NotImplementedException();
 }
 public Stakes AddNewStake(StakesViewModel Svm)
 {
     throw new NotImplementedException();
 }