コード例 #1
0
 public ActionResult ProjectFunds(int project_id)
 {
     {
         FundManager fd      = new FundManager();
         List <Fund> list_fd = fd.List(x => x.Project.Id == project_id);
         return(View(list_fd));
     }
 }
コード例 #2
0
        public ActionResult MyProject()
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                if ((Session["user"] as User).IsInvestor == false)
                {
                    UserManager          um       = new UserManager();
                    int                  Ses_id   = (Session["user"] as User).Id;
                    ProjectManager       pm       = new ProjectManager();
                    var                  Projects = pm.List(x => x.user.Id == Ses_id);
                    List <FundViewModel> fvm      = new List <FundViewModel>();
                    foreach (var item in Projects)
                    {
                        fvm.Add(new FundViewModel()
                        {
                            Id            = item.Id,
                            ProjectAmount = item.ProjectAmount,
                            ProjectDate   = item.ProjectDuration,
                            ProjectName   = item.ProjectName,
                            ProjectTitle  = item.ProjectTitle
                        });
                    }
                    return(View((fvm)));
                }
                else
                {
                    List <FundViewModel> fundModel = new List <FundViewModel>();
                    ProjectManager       pm        = new ProjectManager();
                    UserManager          um        = new UserManager();
                    int            sessionId       = (Session["user"] as User).Id;
                    FundManager    fm       = new FundManager();
                    List <Fund>    funds    = fm.List(x => x.user_Investor.Id == sessionId);
                    List <Project> projects = new List <Project>();
                    foreach (Fund element in funds)
                    {
                        FundViewModel fvm = new FundViewModel();
                        Project       p   = pm.Find(x => x.Id == element.Project.Id);

                        fvm.ProjectAmount = element.Amount;
                        fvm.ProjectDate   = element.Date;
                        fvm.ProjectName   = p.ProjectName;
                        fvm.ProjectTitle  = p.ProjectTitle;
                        fvm.Id            = p.Id;
                        fundModel.Add(fvm);
                    }
                    return(View(fundModel));
                }
            }
        }