Example #1
0
        // 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());
        }
Example #2
0
        // 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));
        }
Example #3
0
        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());
            }
        }
Example #4
0
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            try
            {
                await FundLib.DeleteFund(id);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Example #5
0
        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());
            }
        }
Example #6
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));
        }
Example #7
0
        // GET: Funds
        public async Task <ActionResult> Index()
        {
            var funds = await FundLib.GetAllFunds();

            return(View(funds));
        }