示例#1
0
 public ActionResult Edit(Silo silo)
 {
     if (ModelState.IsValid)
     {
         SiloService.UpdateSilo(silo);
         return RedirectToAction(INDEX_VIEW);
     }
     else
     {
         return View(GetModel(silo));
     }
 }
示例#2
0
 public ActionResult Create(Silo silo)
 {
     if (ModelState.IsValid)
     {
         SiloService.CreateSilo(silo);
         return Json("Success", JsonRequestBehavior.AllowGet);
         //return RedirectToAction(INDEX_VIEW);
     }
     else
     {
         return Json("Error", JsonRequestBehavior.AllowGet);
         //return View(GetModel(silo));
     }
 }
示例#3
0
 public void UpdateSilo(Silo silo)
 {
     SiloRepository.UpdateSilo(silo);
 }
示例#4
0
 public void DeleteSilo(Silo silo)
 {
     SiloRepository.DeleteSilo(silo);
 }
示例#5
0
 public void CreateSilo(Silo silo)
 {
     SiloRepository.CreateSilo(silo);
 }
示例#6
0
 public ActionResult Delete(Silo silo)
 {
     SiloService.DeleteSilo(silo);
     return Json(JSON_SUCCESS, JsonRequestBehavior.AllowGet);
 }
示例#7
0
 private SiloViewModel GetModel(Silo silo)
 {
     return new SiloViewModel(silo, PlantaService.ReadPlanta());
 }
示例#8
0
 public SiloViewModel(Silo silo, IEnumerable<Planta> plantas)
 {
     Silo = silo;
     _plantas = plantas;
 }
示例#9
0
 public SiloViewModel(Silo silo)
 {
     Silo = silo;
 }