示例#1
0
        // GET: Holding/Details/5
        public async Task <ActionResult> Details(string id)
        {
            var holding = await HoldingLib.GetHolding(id.ToString());

            if (holding == null)
            {
                var errorMsg = string.Format("Holding {0} not found.", id);
                throw new HttpException(404, errorMsg);
            }
            return(View(holding));
        }
示例#2
0
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            try
            {
                await HoldingLib.DeleteHolding(id);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#3
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,HoldingId,EmployeeId,FundId,SharesOwned")] Holding holding)
        {
            try
            {
                await HoldingLib.UpdateHolding(holding);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
示例#4
0
        public async Task <ActionResult> Create([Bind(Include = "Id,HoldingId,EmployeeId,FundId,SharesOwned")] Holding holding)
        {
            try
            {
                var rand = new Random();
                var id   = rand.Next().ToString();
                holding.Id = id;
                await HoldingLib.InsertHolding(holding);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
示例#5
0
        // 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));
        }
示例#6
0
        // GET Holding/EmployeeHoldings/00001
        public async Task <ActionResult> EmployeeHoldings(string id)
        {
            var holdings = await HoldingLib.GetHoldingByEmployeeId(id);

            return(View("Index", holdings));
        }
示例#7
0
        // GET: Holding
        public async Task <ActionResult> Index()
        {
            var holdings = await HoldingLib.GetAllHoldings();

            return(View(holdings));
        }