Exemplo n.º 1
0
        public async Task <IActionResult> Edit(EmpleadoProduccionViewModel model)
        {
            if (ModelState.IsValid)
            {
                var empleadoProduccion = await converterHelper.ToEmpleadoProduccionAsync(model);

                try
                {
                    await this.empleadoProduccionRepository.UpdateAsync(empleadoProduccion);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!await this.empleadoProduccionRepository.ExistAsync(empleadoProduccion.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(model));
        }
Exemplo n.º 2
0
        // GET: EmpleadosProduccion/Create
        public IActionResult Create()
        {
            var model = new EmpleadoProduccionViewModel
            {
                Fases = combosHelper.GetComboFases(),
            };

            return(View(model));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create(EmpleadoProduccionViewModel model)
        {
            if (ModelState.IsValid)
            {
                var empleadoProduccion = await converterHelper.ToEmpleadoProduccionAsync(model);


                await this.empleadoProduccionRepository.CreateAsync(empleadoProduccion);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(model));
        }
Exemplo n.º 4
0
        //Empleado Produccion
        public async Task <EmpleadoProduccion> ToEmpleadoProduccionAsync(EmpleadoProduccionViewModel model)
        {
            return(new EmpleadoProduccion
            {
                Id = model.Id,

                Nombre = model.Nombre,

                ApellidoPaterno = model.ApellidoPaterno,

                ApellidoMaterno = model.ApellidoMaterno,

                Direccion = model.Direccion,

                Cargo = model.Cargo,

                Ci = model.Ci,

                Telefono = model.Telefono,

                //aqui se busca en la tabla fases la fase seleccionada
                Fase = await _dataContext.Fases.FindAsync(model.FaseId),
            });
        }