public ActionResult Index() { InvestorAuth cred = check_clientRelation(); if (!cred.Valid) { return(Redirect(@"/User/Index/")); } manageClient_Sessions(cred); Models.InvestorIndexViewModel investorAccount = new Models.InvestorIndexViewModel(User.Identity.GetUserId(), cred.Investor_Id); return(View(investorAccount)); }
public ActionResult Details(int id, string Investor_Message) { Models.InvestorIndexViewModel investorModel = new Models.InvestorIndexViewModel(User.Identity.GetUserId(), id); SessionUserAccessor session = get_SessionIDs(); if (session.Entrepreneur_ID > 0) { investorModel.message_Investor(id, session.Entrepreneur_ID, 4, Investor_Message); } else if (session.Investor_ID > 0) { investorModel.message_Investor(id, session.Investor_ID, 3, Investor_Message); } else { investorModel.message_Investor(id, investorModel.User_Id, 1, Investor_Message); } return(View(investorModel)); }
public ActionResult Details(int id) { Models.InvestorIndexViewModel investorModel; if (User.Identity.GetUserId() != null) { SessionUserAccessor session = get_SessionIDs(); if (session.Entrepreneur_ID > 0) { investorModel = new Models.InvestorIndexViewModel(User.Identity.GetUserId(), id, session.Entrepreneur_ID); if (investorModel.Profile_Public) { return(View(investorModel)); } else { return(Redirect("/Search/Index")); } } else if (session.Investor_ID > 0) { investorModel = new Models.InvestorIndexViewModel(User.Identity.GetUserId(), id, session.Investor_ID); if (investorModel.Profile_Public) { return(View(investorModel)); } else { return(Redirect("/Search/Index")); } } } else { investorModel = new Models.InvestorIndexViewModel(); investorModel.get_InvestorData(id); if (investorModel.Profile_Public) { return(View(investorModel)); } } return(Redirect("/Search/Index")); }
/// <summary> /// Private method that authenticates whether or not the user and investor are related. /// </summary> /// <returns></returns> private InvestorAuth check_clientRelation() { InvestorAuth cred = new InvestorAuth(); // we have to get the investor id from the url pattern for this page. int investor_id = 0; string[] holding = Request.RawUrl.Split(new char[] { '/' }); try { investor_id = Convert.ToInt32(holding[holding.Count <string>() - 1]); } catch { System.Diagnostics.Debug.WriteLine("No Investor Id parameter was passed in."); } Models.InvestorIndexViewModel authModel = new Models.InvestorIndexViewModel(User.Identity.GetUserId(), investor_id); cred.Valid = authModel.Valid; cred.Investor_Id = investor_id; cred.User_Id = authModel.User_Id; return(cred); }