Example #1
0
        public bool doLogIn(string email, string password)
        {
            var hashedPassword = generateHash(password);

            using (var db = new DataClassesDataContext())
            {
                var user = from c in db.customers
                            where email == c.email && hashedPassword == c.password
                            select c;

                return user.Count() != 1;
            }
        }
Example #2
0
        public string insertCustomer(Webstore.Models.customer customer)
        {
            try
            {
                using (var db = new DataClassesDataContext())
                {
                    var zip = from z in db.cities
                              where z.zipcode == customer.zipcode
                              select z;

                    if (zip.Count() == 0)
                    {
                        return "This is not a norwegian zipcode";
                    }
                    db.customers.InsertOnSubmit(customer);
                    db.SubmitChanges();
                    return "You've been registered! You will now be redirected back to the store";
                }
            }
            catch
            {
                return "Something went wrong. Try again later.";
            }
        }