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)); }
// GET: EmpleadosProduccion/Create public IActionResult Create() { var model = new EmpleadoProduccionViewModel { Fases = combosHelper.GetComboFases(), }; return(View(model)); }
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)); }
//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), }); }