public Account GetAccount(string nickName)
 {
     using (var accountContext = new AccountContext())
     {
         return(accountContext.Accounts
                .Where(q => q.NickName == nickName)
                .FirstOrDefault());
     }
 }
 public bool CreateProject(Project project)
 {
     using (var a = new AccountContext())
         using (var b = new CommitContext())
             using (var projectContext = new ProjectContext())
             {
                 projectContext.Projects.Add(project);
                 projectContext.SaveChanges();
             }
     return(true);
 }
        public Account SignIn(string login, string password)
        {
            var account = new Account();

            using (var accountContext = new AccountContext())
            {
                var result = accountContext.Accounts
                             .Where(q => q.Login == login && q.Password == password)
                             .FirstOrDefault();

                return(result);
            }
        }
        public bool SignUp(Account account)
        {
            using (var accountContext = new AccountContext())
            {
                var accountExists = accountContext.Accounts
                                    .Where(q => q.Login == account.Login || q.NickName == account.NickName)
                                    .FirstOrDefault() != null;

                if (accountExists)
                {
                    return(false);
                }

                accountContext.Accounts.Add(account);
                accountContext.SaveChanges();
            }
            return(true);
        }