public IHttpActionResult PostAccount(AccountsModel account)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }
            var dbPostAccount = new Account();

            dbPostAccount.Update(account);

            db.Accounts.Add(dbPostAccount);

            db.SaveChanges();

            account.CustomerID = dbPostAccount.CustomerID;

            return CreatedAtRoute("DefaultApi", new { id = dbPostAccount.CustomerID }, account);
        }
        public IHttpActionResult PostAccount(AccountModel account)
        {
            // Validate the request
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            // Set up new Account object,
            //  and populate it with the values from
            //  the input AccountModel object
            Account dbAccount = new Account();
            dbAccount.Update(account);

            // Add the new Account object to the list of Account objects
            db.Accounts.Add(dbAccount);

            // Save the changes to the DB
            try
            {
                db.SaveChanges();
            }
            catch (Exception)
            {

                throw new Exception("Unable to add the account to the database.");
            }

            // Update the AccountModel object with the new account ID
            //  that was placed in the Account object after the changes
            //  were saved to the DB
            account.AccountId = dbAccount.AccountId;
            return CreatedAtRoute("DefaultApi", new { id = dbAccount.AccountId }, account);
        }