public async Task <IActionResult> Edit(int id, [Bind("ExpProfissionalId,DataInicio,DataFim,NomeEmpresa,Funcao,DadosPessoaisId")] ExpProfissional expProfissional) { if (id != expProfissional.ExpProfissionalId) { return(NotFound()); } if (ModelState.IsValid) { try { bd.Update(expProfissional); await bd.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExpProfissionalExists(expProfissional.ExpProfissionalId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DadosPessoaisId"] = new SelectList(bd.DadosPessoais, "DadosPessoaisId", "Email", expProfissional.DadosPessoaisId); return(View(expProfissional)); }
public async Task <IActionResult> Edit(int id, [Bind("ExpProfissionalId,Empresa,Funcao,Detalhes,Data")] ExpProfissional expProfissional) { if (id != expProfissional.ExpProfissionalId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(expProfissional); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExpProfissionalExists(expProfissional.ExpProfissionalId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(expProfissional)); }
public ActionResult Create(ExpProfissional exp) { var userId = User.Identity.GetUserId(); exp.PerfilId = UserManager.Users.FirstOrDefault(x => x.Id == userId).PerfilId; _expManager.Create(exp); return(RedirectToAction("Index")); }
public async Task <IActionResult> Create([Bind("ExpProfissionalId,Empresa,Funcao,Detalhes,Data")] ExpProfissional expProfissional) { if (ModelState.IsValid) { _context.Add(expProfissional); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(expProfissional)); }
public async Task <IActionResult> Create([Bind("ExpProfissionalId,DataInicio,DataFim,NomeEmpresa,Funcao,DadosPessoaisId")] ExpProfissional expProfissional) { if (ModelState.IsValid) { bd.Add(expProfissional); await bd.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DadosPessoaisId"] = new SelectList(bd.DadosPessoais, "DadosPessoaisId", "Email", expProfissional.DadosPessoaisId); return(View(expProfissional)); }