- 【待解決】 如果我在 route.config 里修改了 transaction的create,之后會(huì)怎么樣市殷?屈尼??
作業(yè)細(xì)節(jié)要求
A bank accounts listing with URL suffix /Bank/Account/List, shows all of the accounts presently open.
The user should see this screen upon first logging in.
The listing should show the name of the account, account number and current balance of each one (see create account screen below for details), as well as a link that navigates the user to the account details screen for that account (see below), and a link that deletes the account /Bank/Account/Delete/{id}.
See Html.ActionLink and the Visual Studio scaffolding features for ideas on implementing these links. The user should be asked to confirm the deletion first.
- 【已完成】都要先登錄再操作
- 【已完成】URL后綴 /Bank/Account/List 褐着,其中設(shè)置的name就是在
Html.ActionLink
會(huì)使用到的參數(shù)
routes.MapRoute(
name: "Index",
url: "Bank/Account/List",
defaults: new { controller = "BankAccounts", action = "Index", id = UrlParameter.Optional }
);
- 【已完成】 /Bank/Account/Delete/{id} ,id應(yīng)該就是創(chuàng)建時(shí)候的 PK*
routes.MapRoute(
name: "Delete",
url: "Bank/Account/Delete/{id}",
defaults: new { controller = "BankAccounts", action = "Delete", id = UrlParameter.Optional }
);
- 【已完成】顯示 name of the account, account number and current balance of each one
- 【已完成】a link that navigates the user to the account details*
- 【未完成】我不知道算不算是有個(gè)彈出的 確然刪除托呕,controller 本身就有個(gè)自動(dòng)生成的comfirm含蓉,我還需要做嗎?项郊?
Delete
Hint: implement this as a form with just a submit button. Create two controller actions:
one action for GET requests, which asks the user to confirm by pressing a button. Create a
second one adorned with the [HttpPost] attribute that processes the form and performs the
“deletion” and informs the user that is has been deleted (or error, if there was an error).
route.config
routes.MapRoute(
name: "Index",
url: "Bank/Account/List",
defaults: new { controller = "BankAccounts", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Delete",
url: "Bank/Account/Delete",
defaults: new { controller = "BankAccounts", action = "Create", id = UrlParameter.Optional }
);
When deleting an account, you should not actually delete it from the database, but rather flag it to be hidden using a Boolean in the model for the account. Once an account is “deleted” (i.e., hidden), the system should behave as if the account was in fact deleted from the database. For example, it should never again be viewable or accessible in any way through the user interface, nor should any transactions for that account be viewable. An account must have a $0.00 balance prior to deletion.
- 【已完成】只是隱藏不刪除
- 【已完成】彈出一個(gè)窗口谴餐,顯示如果不是0,不可以刪除
- 【未完成】隱藏了某個(gè)賬戶(hù)呆抑,在Transaction里也不應(yīng)該看見(jiàn)了
A create account screen with URL suffix /Bank/Account/Create.
Starts a new checking account with a $0.00 balance. The user should be able to enter a descriptive name for the account (e.g. “Mary’s Main Checking Account”) and account number of the new checking account to be created.
The account number must be exactly 7 digits and be unique among all other accounts at the bank. When finished, this should take the user back to the bank accounts listing above.
- 【已解決】/Bank/Account/Create
- 【已解決】用戶(hù)可以直接命名
- 【已解決】但是默認(rèn)起始余額是 $0
- 【已解決】account number 也需要做用戶(hù)做初始化
- 【已解決】完成賬戶(hù)create,轉(zhuǎn)回到 listing view
- 【待解決】 如果我在 route.config 里修改了 transaction的create汁展,之后會(huì)怎么樣鹊碍??食绿?
An account details screen (/Bank/Account/{id}/Transaction/List),
which shows the account name, account number, current account balance,
and a listing of the 10 most recent transactions for the account specified in the URL. Each transaction should show the date, description, and amount of the transaction as well as a balance. There should be a “Create Transaction” button that takes the user to the new transaction screen, discussed below. An example of the transaction list is shown below in Table 1. You may show the comma in the numeric formatting, but this is not a requirement.
- 【已完成】Account Detail的界面包括了account name, account number, current account balance
- 【已完成】包括了最近10次的交易侈咕,用的是linq,不要在View里改器紧,只顯示當(dāng)前的Account
- 【已完成】每筆交易要顯示日期耀销,描述,交易金額铲汪,余額
- 【已完成】需要有 “Create Transaction”
- 【已完成】may show the comma in the numeric formatting
- 【已完成】 (/Bank/Account/{id}/Transaction/List)
public ActionResult AccountDetail(int id)
{
var transactions = db.Transactions.Include(t => t.BankAccount);
var currenttransactions = (from u in transactions
where u.BankAccountID == id
orderby u.TransactionDate descending
select u).Take(10);
return View(currenttransactions.ToList());
}
However, all decimals must be displayed to 2 decimal places.
See String.Format for ideas. Note that negative amounts are typically shown by enclosing the amount in parentheses.
Clicking on a transaction should take you to the transaction details screen,
discussed below.
1.【已解決】都要是2位小數(shù)熊尉,負(fù)號(hào)用括號(hào)表示
2.【已解決】 最后我也沒(méi)有用String.Format 罐柳, 而是在public double TransactionBalance { get; set; }
前面使用了[DisplayFormat(DataFormatString = "{0:$#,##0.00;($#,##0.00)}", ApplyFormatInEditMode = true)]
的注解
A new transaction screen (/Bank/Account/{id}/Transaction/Create), in which the user can create a new transaction for the account specified in the URL. Each transaction shall consist of at least: a globally unique primary key serving as a transaction number (database generated and not visible on this screen), the date and time of the transaction (need not be shown on the screen), a textual description of the transaction, and the amount of the transaction expressed as a positive decimal. A separate drop down list on the screen which is statically populated with the options “Check” or “Deposit” will indicate the type of transaction.
Although this is how it should appear on the screen, you may represent check or deposit transactions however you wish in the model.
- 【已解決】 (/Bank/Account/{id}/Transaction/Create)
- 【已解決】DropDownList,可以保存 bool
- 【已解決】保存之后
- 【已解決】新的交易屏幕 (/Bank/Account/{id}/Transaction/Create)
- 【已完成】【自動(dòng)完成】每筆交易至少應(yīng)包括:作為transaction number--- unique primary key(數(shù)據(jù)庫(kù)已生成并且在此屏幕上不可見(jiàn))
- 【已完成】交易的日期和時(shí)間(不需要在屏幕上顯示)
- 【已完成】 文本描述交易以及交易金額表示為正數(shù)小數(shù)狰住。
- 在屏幕上單獨(dú)的drop down list 中靜態(tài)填充選項(xiàng)“Check” or “Deposit”將顯示交易類(lèi)型张吉。
- 【已解決】用戶(hù)可以在該屏幕中為URL中指定的賬戶(hù)創(chuàng)建新的交易。
- 【已解決】關(guān)于balance的加減法催植!deposit 要加肮蛹!
- 【未解決】Transaction Index 顯示type還是 勾
- Although this is how it should appear on the screen, you may represent check or deposit transactions however you wish in the model. 這句話沒(méi)有讀懂
There should exist a Submit and Cancel button at the bottom of the screen. Transactions cannot be deleted once created, though they should be completely hidden from view if the parent account is deleted.
Upon pressing the Submit button, the following validation should occur: all visible fields should be required.
The transaction cannot be for $0.00, less than -$5,000.00 or more than $5,000.00.
Transactions that would bring the account balance below $0.00 are not permitted.
If valid, the transaction should be recorded and the user taken to the account transactions screen, described below. If the user presses the Cancel button, they should be directed to the account details screen described above.
- 【已完成】該交易不能為$ 0.00,小于 - $ 5,000.00或超過(guò)$ 5,000.00
- 【已完成】屏幕底部應(yīng)該有一個(gè)提交和取消按鈕创南。
- 【已完成】不允許將賬戶(hù)余額低于0.00美元的交易
- 【已完成】如下所述伦忠。如果用戶(hù)按下“取消”按鈕,則應(yīng)將其指向上述帳戶(hù) account details screen
【未完成】交易無(wú)法在創(chuàng)建后刪除稿辙,但如果父賬戶(hù)被刪除昆码,它們應(yīng)該完全隱藏。
【未完成】按提交按鈕后邓深,應(yīng)該發(fā)生以下驗(yàn)證:all visible fields should be required
【已完成】如果有效未桥,應(yīng)記錄交易并將用戶(hù)帶到 account transactions screen
A transaction details screen (/Bank/Account/{id1}/Transaction/{id2}) where {id1} is a the account number and {id2} is the transaction number. You should validate that the transaction corresponds to the account in question. The transaction details screen should provide a “read only” 3 view of the transaction: date and time of the transaction (month, day, and year, hour and minute), description of the transaction, and the amount of the transaction expressed as a decimal (positive for deposit, negative for check). A button should take the user back to the account details screen. Users should under no circumstance be allowed to view accounts that are not theirs or transactions for accounts that are not theirs. Other requirements are as follows:
- 【未解決】