예제 #1
0
        /// <summary>
        /// Get all accounts
        /// </summary>
        /// <returns>Collection of accounts</returns>
        public AccountCollection Get()
        {
            AccountCollection Accounts = new AccountCollection();

            foreach (Account account in DB.Accounts)
            {
                Accounts.AddAccount(account);
            }
            return(Accounts);
        }
        public IActionResult Post([FromBody] Account value)
        {
            if (value == null)
            {
                return(BadRequest());
            }

            if (!_collection.AddAccount(value))
            {
                return(BadRequest());
            }

            return(CreatedAtRoute("/api/[controller]/", new { id = value.AccountId }, value));
        }