public ActionResult ZoneCreate(ZoneViewModel model)
 {
     if (ModelState.IsValid)
     {
         var mo = new Zone()
             {
                 Name = model.Name,
             };
         _stagedZoneService.Delete(model.Id);
         _zoneService.Create(mo);
         this.AccessContext.FlushChanges();
         mo.UniqueId = "Z" + mo.Id;
         return Json(new {});
     }
     ModelState.AddModelError("", "There are validation Errors");
     return PartialView(model);
 }
Exemple #2
0
 public ActionResult ZoneEdit(ZoneViewModel model)
 {
     if (ModelState.IsValid)
     {
         var m = _zoneService.GetSingle(model.Id);
         m.Name = model.Name;
         m.UniqueId = model.UniqueId;
         return Json(new {});
     }
     return PartialView(model);
 }
 public PartialViewResult ZoneCreate(int id)
 {
     var m = _stagedZoneService.GetSingle(id);
     var model = new ZoneViewModel()
         {
             Name = m.Name,
             UniqueId = m.UniqueId,
             Id = m.Id
         };
     return PartialView(model);
 }
Exemple #4
0
 public ActionResult ZoneCreate(ZoneViewModel model)
 {
     if (ModelState.IsValid)
     {
         ;
         var m = Mapper.Map<Zone>(model);
         _zoneService.Create(m);
         this.AccessContext.FlushChanges();
         m.UniqueId = "Z" + m.Id;
         return Json(new {});
     }
     return PartialView(model);
 }