コード例 #1
0
 //
 // GET: /Fund/Edit/5
 public ActionResult Edit(int id)
 {
     SystemEntities repository = new SystemEntities();
     Fund model = repository.Funds.Single(f => f.ID == id);
     PopulateViewBag();
     return View(model);
 }
コード例 #2
0
 //public ActionResult Details(int id)
 //{
 //    return View();
 //}
 //
 // GET: /Fund/Create
 public ActionResult Create()
 {
     SystemEntities repository = new SystemEntities();
     Fund model = new Fund();
     PopulateViewBag();
     return View(model);
 }
コード例 #3
0
 public ActionResult Create(Fund fund)
 {
     if(ModelState.IsValid)
     {
         SystemEntities repository = new SystemEntities();
         repository.Funds.Add(fund);
         repository.SaveChanges();
         return RedirectToAction("Index", "Home");
     }
     PopulateViewBag();
     return View(fund);
 }
コード例 #4
0
 public ActionResult Edit(int id, FormCollection collection)
 {
     SystemEntities repository = new SystemEntities();
     Fund fund = repository.Funds.Find(id);
     if(TryUpdateModel(fund))
     {
         repository.SaveChanges();
         return RedirectToAction("index", "Home");
     }
     else
     {
         PopulateViewBag();
         return View(fund);
     }
 }
コード例 #5
0
 //
 //// GET: /Fund/Delete/5
 //public ActionResult Delete(int id)
 //{
 //    return View();
 //}
 ////
 //// POST: /Fund/Delete/5
 //[HttpPost]
 //public ActionResult Delete(int id, FormCollection collection)
 //{
 //    try
 //    {
 //        // TODO: Add delete logic here
 //        return RedirectToAction("Index");
 //    }
 //    catch
 //    {
 //        return View();
 //    }
 //}
 private void PopulateViewBag()
 {
     SystemEntities repository = new SystemEntities();
     ViewBag.Managers = repository.Managers;
     ViewBag.Strategies = repository.Strategies;
 }
コード例 #6
0
 public ActionResult Index()
 {
     ViewBag.Message = "Welcome to DevExpress Extensions for ASP.NET MVC!";
     IEnumerable<Manager> model = new SystemEntities().Managers.Include("Funds").OrderBy(M=>M.Name);
     return View(model);
 }