// ------------------------------ Account ------------------------------- #region Account /// <summary> /// Creates and Adds a new account to the Database /// </summary> /// <param name="email">Email Address</param> /// <returns></returns> public Model.Account AddAccount(string email) { /* Account account = null; * * account = new Account * { * UserName = userName, * Email = email, * Password = password, * ID = 1 // HACK: This needs to be changed so it is automatically updated by the DB * }; * try * { * stubADB.accounts.Add(account); * } * catch (Exception) * { * account = null; * throw; * }*/ Model.Account account = ConvertAccount(accrepo.AddAccount(email)); return(account); }
/// <summary> /// Find an account based the provided Account ID /// </summary> /// <param name="accID">Account ID</param> /// <returns>Returns either an Account if something is found, /// or null if none are found.</returns> public Model.Account FindAccount(string email) { /* Account account = null; * * foreach (Account a in stubADB.accounts) * { * if (a.ID == accID) * { * account = a; * } * }*/ Model.Account acc = ConvertAccount(accrepo.FindAccount(email)); return(acc); }
private Model.Account ConvertAccount(Account account) { if (account != null) { Model.Account mAccount = new Model.Account { ID = account.id, Email = account.email }; return(mAccount); } else { return(null); } }