public ActionResult Delete(Celebrity model) { using (var tran = RepositoryFactory.StartTransaction()) { var itemToDelete = RepositoryFactory.Command<ICelebrityCommands>().FindByPk("celebrities/" + model.Id); RepositoryFactory.Command<ICelebrityCommands>().Delete(itemToDelete); tran.Commit(); SessionFactory.WaitForStaleIndexes(); return RedirectToActionWithAjax("Index"); } return ViewWithAjax(model); }
public ActionResult Create(Celebrity model) { if (ModelState.IsValid) { using (var tran = RepositoryFactory.StartTransaction()) { RepositoryFactory.Command<ICelebrityCommands>().Create(model); tran.Commit(); SessionFactory.WaitForStaleIndexes(); return RedirectToActionWithAjax("Index"); } } ViewBag.Devices = RepositoryFactory.Command<IDeviceCommands>().GetAll().OrderBy(item => item.Name).ToArray(); return ViewWithAjax(model); }