Exemplo n.º 1
0
 public ActionResult Create(Device model)
 {
     if (ModelState.IsValid)
     {
         using (var tran = RepositoryFactory.StartTransaction())
         {
             RepositoryFactory.Command<IDeviceCommands>().Create(model);
             tran.Commit();
             SessionFactory.WaitForStaleIndexes();
             return RedirectToActionWithAjax("Index");
         }
     }
     return ViewWithAjax(model);
 }
Exemplo n.º 2
0
 public ActionResult Delete(Device model)
 {
     if (ModelState.IsValid)
     {
         using (var tran = RepositoryFactory.StartTransaction())
         {
             var itemToDelete = RepositoryFactory.Command<IDeviceCommands>().FindByPk("devices/" + model.Id);
             RepositoryFactory.Command<IDeviceCommands>().Delete(itemToDelete);
             tran.Commit();
             SessionFactory.WaitForStaleIndexes();
             return RedirectToActionWithAjax("Index");
         }
     }
     return ViewWithAjax(model);
 }