c# - How to return IEnumerable<Class> from Grid Kendo to Controller? -


i load information grid kendo, , user can changes values of multiple employees, click on button save changes. want return information (list) controller update.

model:

 public class authorizationmodel {     [editable(false)]       [display(name = "no. nómina")]     public int idroster { get; set; }      [editable(false)]       [display(name="empleado")]     public string  employee { get; set; }      [display(name = "estatus")]     public string status { get; set; }      [display(name = "comentarios")]     [datatype(datatype.multilinetext)]     public string comment { get; set; }     ..............//property    ..............//property } 

controller:

   [httpget()]     [route("autorizacion")]     [authorize()]     public actionresult authorization()     {         _orderbll = new orderbll();         var models = new list<authorizationmodel>();         var orders = _orderbll.getpendingorders();         foreach (var order in orders)         {             var model = new authorizationmodel();              model.idroster = int.parse(order.numnom_cte);             model.employee = order.nombreempleado;             //other properties             if (order.estfin_aui.toupper()== "p")             model.status = "pendiente";              models.add(model);         };          return view(models);     }      [httppost()]     [route("autorizacion")]     public actionresult authorization(ienumerable<authorizationmodel> model)     {      //do information         return view();     } 

view:

@model ienumerable<elizondomx.models.order.authorizationmodel> @using kendo.mvc.ui; @using elizondomx.telerik.extensions; @{     layout = "~/views/shared/_layout.cshtml"; }        @using (html.beginform("authorization", "order", formmethod.post))     { <body>             @(html.kendo().grid(model)            .name("ordersgrid")            .columns(columns =>            {                columns.bound(c => c.idroster).title("no. nómina");                columns.bound(c => c.employee).title("empleado");                columns.boundactionlink((item) => item.idorder, "detail", "order", (item) => new { id = item.idorder });                columns.bound(c => c.status).title("estatus").editortemplatename("statusdropdown");                columns.bound(c => c.comment).title("comentarios");            })            .excel(excel => excel                .filename("elizondo_pedidos.xlsx")                .filterable(true)             )             .editable(editable => editable.mode(grideditmode.incell))             .selectable(s => s.enabled(true)                             .type(gridselectiontype.row)                             .mode(gridselectionmode.single))            .toolbar(toolbar => toolbar.excel().text("exportar excel"))            .sortable()            .htmlattributes(new { style = "height: auto;margin: 0px;" })            .datasource(datasource => datasource                .ajax()                .events(events => events.error("error_handler"))                .model(model=>  model.id(p => p.idroster))                .read(read=> read.action("authorization", "order"))            ))     <input type="submit"  value="actualizar estatus" class="btn btn-primary" /> </body>       } </html> 


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -