Beispiel #1
0
 private bool CheckSql(string userName)
 {
     List<Users> userses;
     using(DataUsersEntities us = new DataUsersEntities())
     {
         userses = us.Users.Where(x => x.UserName == userName).ToList();
     }
     if(userses.Count == 0)
     {
         return true;
     }
     return false;
 }
Beispiel #2
0
        public Registration()
        {
            Post["/registered"] = x =>
            {
                var userName = (string)this.Request.Form.UserName;

                var password = (string)this.Request.Form.Password;

                if(CheckLengh(userName, password))
                {
                    return HttpStatusCode.Unauthorized;
                }

                using(user = new DataUsersEntities())
                {
                    user.Users.Add(new Users { UserName = userName, Password = password });
                    user.SaveChanges();
                }
                return HttpStatusCode.OK;
            };
        }