コード例 #1
0
        public void Update(OwnerAccount accountChange)
        {
            var account = context.Owners.Attach(accountChange);

            account.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            context.SaveChanges();
        }
コード例 #2
0
        public OwnerAccount GetAnOwnerEmailPass(string email, string password)
        {
            OwnerAccount account = context.Owners.Where(a => a.UserEmail.Equals(email)).FirstOrDefault();

            if (account == null || !encryption.Authenticate(password, account.UserPassword))
            {
                // Owner does not exist
                return(null);
            }
            else
            {
                // Owner Exists
                return(account);
            }
        }
コード例 #3
0
        public bool CheckOwner(OwnerAccount accountCheck)
        {
            OwnerAccount account = context.Owners.Where(a => a.UserEmail.Equals(accountCheck.UserEmail)).FirstOrDefault();


            if (account == null || !encryption.Authenticate(accountCheck.UserPassword, account.UserPassword))
            {
                // Owner does not exist
                return(false);
            }
            else
            {
                // Owner Exists
                return(true);
            }
        }
コード例 #4
0
 public void Delete(OwnerAccount account)
 {
     context.Owners.Remove(account);
     context.SaveChanges();
 }
コード例 #5
0
 public void Add(OwnerAccount account)
 {
     account.UserPassword = encryption.HashPassword(account.UserPassword);
     context.Owners.Add(account);
     context.SaveChanges();
 }