Example #1
0
        public bool AddUser(string login, string password, string type, List <string> args)
        {
            string hash = MakeHash(login, password);

            using (var context = new LaborExchangeEntities())
            {
                if (Enumerable.Any(context.Logins, contextLogin => contextLogin.Username == login))
                {
                    return(false);
                }

                var l = new Logins
                {
                    Username = login,
                    Pass     = hash,
                    UserType = type
                };
                context.Logins.Add(l);
                switch (type)
                {
                case "Company":
                    if (!AddCompany(l, args))
                    {
                        return(false);
                    }
                    break;

                case "Employee":
                    if (!AddEmployee(l, args))
                    {
                        return(false);
                    }
                    break;
                }
                context.SaveChanges();
                return(true);
            }
        }
Example #2
0
 private bool AddCompany(Logins l, List <string> args)
 {
     return(false);
 }
Example #3
0
 private bool AddEmployee(Logins l, List <string> args)
 {
     return(false);
 }