public async Task <ActionResult> Registrar(IFormCollection formCollection) { var empleadoItem = await _empleadoAppService.Agregar( new Application.Dtos.EmpleadoDto() { Nombres = formCollection["Nombres"], ApellidoPaterno = formCollection["ApellidoPaterno"] } ); return(RedirectToAction(nameof(Index))); }
public ActionResult Create(EmpleadoViewModel empleado) { if (ModelState.IsValid) { try { var empleadoDominio = Mapper.Map <EmpleadoViewModel, Empleado>(empleado); _empleadoAppService.Agregar(empleadoDominio); return(RedirectToAction("Index")); } catch (Exception ex) { return(View(ex.Message)); } } ViewBag.EmpresaId = new SelectList(_empresaAppService.ObtenerTodo(), "Id", "Descripcion", empleado.EmpresaId); return(View(empleado)); }