示例#1
0
 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());
 }
示例#2
0
 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());
 }
示例#3
0
        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);
        }
示例#4
0
 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();
 }
示例#5
0
 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();
 }
示例#6
0
        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);

        }