示例#1
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);
 }
示例#2
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);
     }
 }