コード例 #1
0
        public ActionResult FundOfProject(FundOfProjectViewModel model, int project_id)
        {
            FundManager fm    = new FundManager();
            UserManager um    = new UserManager();
            User        user  = new User();
            int         sesid = (Session["user"] as User).Id;

            user = um.Find(x => x.Id == sesid);
            Project p      = pm.Find(x => x.Id == project_id);
            bool    result = fm.AddFund(model, user, p);

            if (result)
            {
                return(RedirectToAction("Index", "Home"));
            }

            return(View(model));
        }
コード例 #2
0
        public bool AddFund(FundOfProjectViewModel model, User user, Project project)
        {
            Fund fund = new Fund()
            {
                Amount        = model.ccAmount,
                Date          = DateTime.Now,
                user_Investor = user,
                Project       = project,
            };

            int result = Insert(fund);

            if (result > 0)
            {
                return(true);
            }
            return(false);
        }