public ActionResult ConfirmSell(string tradingAccountID, int buyID)
        {
            if (tradingAccountID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Portfolio       portfolio  = null;
            SailiRepository repository = new SailiRepository();

            portfolio = repository.GetPortfolio(tradingAccountID);

            if (portfolio == null)
            {
                return(HttpNotFound());
            }

            var buy = DefaultConnection.Buys.Find(buyID);

            if (!buy.PortfolioId.Equals(portfolio.PortfolioID))
            {
                DataSerializer <string> .SecurityPriorityNumberOne(User.Identity.GetUserId());

                return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized));
            }

            Company         company  = new Company();
            List <Listings> listings = new List <Listings>();

            company = repository.GetCompany(company, buy.TickerSymbol);
            DataSerializer <string> .GetSingleListings(ref listings, company.Symbol);

            Sell sell = new Sell();

            sell.BuyID         = buy.BuyID;
            sell.TickerSymbol  = buy.TickerSymbol;
            sell.PurchasePrice = buy.PurchasePrice;

            foreach (var list in listings)
            {
                if (list.Symbol.Equals(sell.TickerSymbol))
                {
                    sell.SoldPrice = list.Close;
                }
            }

            TempData["ShareQuantity"] = buy.Quantity;
            TempData["CompanyName"]   = company.CompanyName;

            return(View(sell));
        }
        public JsonResult GetListing(string symbol)
        {
            List <Listings> listings  = null;
            List <Company>  companies = null;
            Company         company   = null;

            company = repository.GetCompany(company, symbol);
            if (company != null)
            {
                companies = new List <Company>();
                companies.Add(company);
                DataSerializer <string> .GetCurrentPrice(ref listings, companies);

                return(Json(listings, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { success = false }));
            }
        }