// GET: Holding/Create public async Task <ActionResult> Create() { var employeesList = await EmployeerLib.GetAllEmployees(); var fundsList = await FundLib.GetAllFunds(); ViewBag.EmployeeId = new SelectList(employeesList, "Id", "FullName"); ViewBag.FundId = new SelectList(fundsList, "Id", "Name"); return(View()); }
// GET: Funds/Edit/5 public async Task <ActionResult> Edit(string id) { var fund = await FundLib.GetFund(id.ToString()); if (fund == null) { var errorMsg = string.Format("Fund {0} not found.", id); throw new HttpException(404, errorMsg); } return(View(fund)); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Ticker")] Fund fund) { try { await FundLib.UpdateFund(fund); return(RedirectToAction("Index")); } catch (Exception ex) { return(View()); } }
public async Task <ActionResult> DeleteConfirmed(string id) { try { await FundLib.DeleteFund(id); return(RedirectToAction("Index")); } catch { return(View()); } }
public async Task <ActionResult> Create([Bind(Include = "Id,Name,Ticker")] Fund fund) { try { var rand = new Random(); var id = rand.Next().ToString(); fund.Id = id; await FundLib.InsertFund(fund); return(RedirectToAction("Index")); } catch (Exception ex) { return(View()); } }
// GET: Holding/Edit/5 public async Task <ActionResult> Edit(string id) { var employeesList = await EmployeerLib.GetAllEmployees(); var fundsList = await FundLib.GetAllFunds(); var holding = await HoldingLib.GetHolding(id.ToString()); if (holding == null) { var errorMsg = string.Format("Holding {0} not found.", id); throw new HttpException(404, errorMsg); } ViewBag.EmployeeId = new SelectList(employeesList, "Id", "FullName", holding.EmployeeId); ViewBag.FundId = new SelectList(fundsList, "Id", "Name", holding.FundId); return(View(holding)); }
// GET: Funds public async Task <ActionResult> Index() { var funds = await FundLib.GetAllFunds(); return(View(funds)); }