コード例 #1
0
 //
 // GET: /Fund/Create
 //public ActionResult Create()
 //{
 //    ViewBag.ApplicantUserName = new SelectList(unitOfWork.Users.ToList(), "UserName", "Name");
 //    ViewBag.ClubId = new SelectList(unitOfWork.Clubs.ToList(), "Id", "Id");
 //    return View();
 //}
 //
 // POST: /Fund/Create
 public ActionResult Add(int application_id)
 {
     FundApplication application = unitOfWork.FundApplications.Find(application_id);
     FundDetails details = new FundDetails {
         Date = DateTime.Today,
         Applicant = application.Applicant,
         Quantity = application.Quantity,
         Purpose = application.Purpose,
         Club = application.Club
     };
     unitOfWork.FundDetailses.Add(details);
     unitOfWork.SaveChanges();
     return RedirectToAction("List", "FundApplication");
 }
コード例 #2
0
 public ActionResult Edit(FundDetails funddetails)
 {
     if (ModelState.IsValid)
     {
         unitOfWork.FundDetailses.Update(funddetails);
         unitOfWork.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.ApplicantUserName = new SelectList(unitOfWork.Users.ToList(), "UserName", "Name", funddetails.ApplicantUserName);
     ViewBag.ClubId = new SelectList(unitOfWork.Clubs.ToList(), "Id", "Id", funddetails.ClubId);
     return View(funddetails);
 }