コード例 #1
0
        public bool Tranfer(int amount, Account to)
        {
            if (Balance - amount < 0)
                return false;

            // let's pretend it's a transaction
            Balance -= amount;
            to.Balance += amount;
            return true;
        }
コード例 #2
0
 public static MvcHtmlString FormatAccount(this HtmlHelper html, Account account)
 {
     var tagBuilder = new TagBuilder("li");
     tagBuilder.InnerHtml = string.Format("{0} - {1}", account.Username, account.Balance);
     return MvcHtmlString.Create(tagBuilder.ToString());
 }