none
Como paso una coleccion de la vista al controlador RRS feed

  • Pregunta

  • Buenas tardes,

    tengo la siguiente vista:

    Ocupa mandar desde esta vista al controlador el horario por cada dia al controlador, no se como hacer eso.

    El codigo de la vista es este:

    @model Proyecto_Rercursos_Humanos.Models.Tbl_Horario
    
    @{
        ViewBag.Title = "Horario Empleado";
        Layout = "~/Views/Shared/_PageDesign.cshtml";
    
        List<Proyecto_Rercursos_Humanos.Models.Tbl_Horario> Horario = new List<Proyecto_Rercursos_Humanos.Models.Tbl_Horario>();
    
    }
    
    @using (Html.BeginForm())
    {
        @Html.AntiForgeryToken()
    
        <div class="container">
    
            <!--Encabezado-->
            <h2 class="header center grey-text">Horas Extras de Empleados</h2>
    
            @Html.ValidationSummary(true, "", new { @class = "text-danger" })
    
    
            <div class="section">
                <h5>Datos Empleado</h5>
    
    
    
                @for (int x = 7, )
                { }
                <!--Campo para datos del empleado-->
                <div class="row">
                    <div class="input-field col l2 s12">
                        @Html.EditorFor(model => model.EmpId, new { htmlAttributes = new { @class = "validate", id="idEmpleado" } })
                        @Html.LabelFor(model => model.EmpId,"Codigo Empleado", htmlAttributes: new { id = "idEmpleado" })  
                    </div>
    
                    <div class="input-field col l4 s12">
                        <input class="validate" id="Nombre" type="text">
                        <label for="Nombre">Nombre:</label>
                    </div>
    
                    <div class="input-field col l3 s12">
                        <input class="validate" id="Depto" type="text">
                        <label for="Depto">Puesto:</label>
                    </div>
    
                    <div class="input-field col l3 s12">
                        <input class="validate" id="Depto" type="text">
                        <label for="Depto">Departamento:</label>
                    </div>
                </div>
            </div>
    
    
            <!--Datos del Horario-->
            
            <div class="section">
                <h5>Datos Jornada de Trabajo</h5>
    
                <!--Campos para datos de la jornada de trabajo-->
                <div class="row">
                    <!--Select para las jornadas de trabajo-->
                    <div class="input-field col l4 s12">
                        @Html.DropDownList("JorId")
                        <label>Jornadas de Trabajo</label>
                    </div>
    
                    <!--Select para los turnos de trabajo-->
                    <div class="input-field col l4 s12">
                        <select>
                            <option value="" disabled selected>Seleccione un Turno</option>
                            <option value="1">Turno A</option>
                            <option value="2">Turno B</option>
                            <option value="3">Turno C</option>
                        </select>
                        <label>Turnos de Trabajo</label>
                    </div>
                </div>
            </div>
    
    
            <!--Seccion del Horario-->
            <div class="row">
                <div class="col s12">
                    <table class="centered">
                        <thead>
                            <tr>
                                <th rowspan="3">D&iacuteas</th>
                            </tr>
                            <tr>
                                <th colspan="4">Horario</th>
                            </tr>
                            <tr>
                                <th>Hora Entrada</th>
                                <th>Hora Inicio Descanso</th>
                                <th>Hora Fin Descanso</th>
                                <th>Hora Salida</th>
                            </tr>
                        </thead>
    
                        <tbody>
    
                            <tr>
                                <td>@Html.TextBox("HorDia","Lunes", new {@readonly = "readonly" })</td>
                                <td>@Html.EditorFor(model => model.HorHoraEntrada, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraInicioDescanso, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraFinDescanso, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraSalida, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                            </tr>
    
                            <tr>
                                <td>@Html.TextBox("HorDia", "Martes", new { @readonly = "readonly" })</td>
                                <td>@Html.EditorFor(model => model.HorHoraEntrada, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraInicioDescanso, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraFinDescanso, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraSalida, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                            </tr>
    
                            <tr>
                                <td>@Html.TextBox("HorDia", "Miércoles", new { @readonly = "readonly" })</td>
                                <td>@Html.EditorFor(model => model.HorHoraEntrada, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraInicioDescanso, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraFinDescanso, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraSalida, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                            </tr>
    
                            <tr>
                                <td>@Html.TextBox("HorDia", "Jueves", new { @readonly = "readonly" })</td>
                                <td>@Html.EditorFor(model => model.HorHoraEntrada, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraInicioDescanso, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraFinDescanso, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraSalida, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                            </tr>
    
                            <tr>
                                <td>@Html.TextBox("HorDia", "Viernes", new { @readonly = "readonly" })</td>
                                <td>@Html.EditorFor(model => model.HorHoraEntrada, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraInicioDescanso, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraFinDescanso, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraSalida, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                            </tr>
    
                            <tr>
                                <td>@Html.TextBox("HorDia", "Sábado", new { @readonly = "readonly" })</td>
                                <td>@Html.EditorFor(model => model.HorHoraEntrada, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraInicioDescanso, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraFinDescanso, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraSalida, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
    
                            <tr>
                                <td>@Html.TextBox("HorDia", "Domingo", new { @readonly = "readonly" })</td>
                                <td>@Html.EditorFor(model => model.HorHoraEntrada, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraInicioDescanso, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraFinDescanso, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                                <td>@Html.EditorFor(model => model.HorHoraSalida, new { htmlAttributes = new { @class = "timepicker", @placeholder = "Dar clic aquí" } })</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
    
    
            <!--Seccion de Botones-->
            <div class="row center" id="btnGuardar">
                <input type="submit" value="Guardar Horario" class="myBtn btn" />  
            </div>
    
        </div>
    
    }
    

    jueves, 30 de noviembre de 2017 20:53

Todas las respuestas