Example #1
0
        public static AccountDetailsViewModel GetAccountDetails(Customer customer)
        {
            using (LoyaltyDB db = new LoyaltyDB())
            {
                var account = db.Accounts.Include("Transactions").Where(a => a.CustomerID == customer.CustomerID).FirstOrDefault();

                var customerAccountDetails = new AccountDetailsViewModel
                {
                    CustomerFullname  = customer.ToString(),
                    AccountNumber     = account.CustomerID.ToString(),
                    Email             = customer.Email,
                    Address           = customer.Address,
                    ActualPeriod      = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(DateTime.Now.Month),
                    Transactions      = account.Transactions,
                    AccumulatedPoints = account.CurrentPointsBalance,
                    CashEquivalent    = account.CurrentMoneyBalance
                };

                return(customerAccountDetails);
            }
        }
 public string GetInfo(Customer cust)
 {
     return(cust.ToString());
 }