Пример #1
0
        public static user ReduceUser(user std)
        {
            CasinoEntities db  = new CasinoEntities();
            user           lst = (from u in db.users where std.uniqueID == u.uniqueID select u).SingleOrDefault();

            lst.balance = lst.balance - std.balance;
            db.SaveChanges();

            return(lst);
        }
Пример #2
0
 public static user RechargeUser(user std)
 {
     if (std.balance > 0)
     {
         CasinoEntities db  = new CasinoEntities();
         user           lst = (from u in db.users where std.uniqueID == u.uniqueID select u).SingleOrDefault();
         lst.balance = lst.balance + std.balance;
         db.SaveChanges();
         return(lst);
     }
     else
     {
         return(null);
     }
 }
Пример #3
0
        public static string SaveUser(user detail)
        {
            using (CasinoEntities db = new CasinoEntities())
            {
                var save  = detail.uniqueID;
                var exist = (from u in db.users where u.uniqueID == detail.uniqueID select u.email).ToList().FirstOrDefault();
                if (exist == null)
                {
                    detail.balance = 500;
                    // detail.password = GetBase64EncodedString(detail.password);
                    db.users.Add(detail);
                    db.SaveChanges();
                }
                else
                {
                    throw new Exception("User Already Exists");
                }

                return(save);
            }
        }