public ActionResult SortPages() { if (Request.Form["pageid"] != null) { //pull out all pageid's var pages = Request.Form.GetValues("pageid").Where(x => !String.IsNullOrEmpty(x)).ToArray(); int listOrder = 0; KonaDB db = new KonaDB(); foreach (var pg in pages) { //subsonic style :) db.Update <Page>().Set(x => x.ListOrder == listOrder).Execute(); listOrder++; } } return(new EmptyResult()); }
public ActionResult OrderWidgets() { if (Request.Form["widgetid"] != null) { //pull out all widgetid's var ids = Request.Form.GetValues("widgetid").Where(x => !String.IsNullOrEmpty(x)).ToArray(); int listOrder = 0; KonaDB db = new KonaDB(); foreach (var id in ids) { var widgetID = new Guid(id); //subsonic style... db.Update <Widget>().Set(x => x.ListOrder == listOrder); listOrder++; } } return(new EmptyResult()); }
public void SaveWidgetOrder() { var commands = new List <DbCommand>(); KonaDB db = new KonaDB(); if (Request.Form["widgetid"] != null) { //pull out all widgetid's var ids = Request.Form.GetValues("widgetid").Where(x => !String.IsNullOrEmpty(x)).ToArray(); int listOrder = 0; foreach (var id in ids) { var widgetID = new Guid(id); //subsonic style... commands.Add(db.Update <Widget>().Set(x => x.ListOrder == listOrder).Where(x => x.WidgetID == widgetID).GetCommand().ToDbCommand()); listOrder++; } } //transaction :) db.ExecuteTransaction(commands); }
public ActionResult OrderWidgets() { if (Request.Form["widgetid"]!=null) { //pull out all widgetid's var ids = Request.Form.GetValues("widgetid").Where(x=>!String.IsNullOrEmpty(x)).ToArray(); int listOrder = 0; KonaDB db = new KonaDB(); foreach (var id in ids) { var widgetID = new Guid(id); //subsonic style... db.Update<Widget>().Set(x => x.ListOrder == listOrder); listOrder++; } } return new EmptyResult(); }
public ActionResult SortPages() { if (Request.Form["pageid"] != null) { //pull out all pageid's var pages = Request.Form.GetValues("pageid").Where(x => !String.IsNullOrEmpty(x)).ToArray(); int listOrder = 0; KonaDB db = new KonaDB(); foreach (var pg in pages) { //subsonic style :) db.Update<Page>().Set(x => x.ListOrder == listOrder).Execute(); listOrder++; } } return new EmptyResult(); }
public void SaveWidgetOrder() { var commands = new List<DbCommand>(); KonaDB db = new KonaDB(); if (Request.Form["widgetid"] != null) { //pull out all widgetid's var ids = Request.Form.GetValues("widgetid").Where(x => !String.IsNullOrEmpty(x)).ToArray(); int listOrder = 0; foreach (var id in ids) { var widgetID = new Guid(id); //subsonic style... commands.Add(db.Update<Widget>().Set(x => x.ListOrder == listOrder).Where(x=>x.WidgetID==widgetID).GetCommand().ToDbCommand()); listOrder++; } } //transaction :) db.ExecuteTransaction(commands); }