Exemplo n.º 1
0
 public bool SignUp(string phone, string password, string email, int code)
 {
     try
     {
         HashMD5 md5 = new HashMD5();
         _dataBase.Users.Add(new Users {
             email = email, id_accessstatud = USER_ID, phone = phone, password = md5.HashPassword(password)
         });
         _dataBase.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 2
0
        // Market : MakeOrder, etc
        public bool MakeOrder(int p_id, string userphone, DateTime dt, string fullprice, string count)
        {
            Orders order = new Orders
            {
                id_product = p_id,
                id_user    = _database.Users.Single(u => u.phone == userphone).id,
                full_cost  = double.Parse(fullprice),
                date       = dt,
                count      = int.Parse(count),
                id_state   = 1
            };

            try
            {
                _database.Orders.Add(order);
                _database.SaveChanges();
                return(true);
            }

            catch (Exception)
            {
                return(false);
            }
        }