public ActionResult Edit(int id, PertenceModel pertenceModel) { if (ModelState.IsValid) { var pertence = _mapper.Map <Pertence>(pertenceModel); pertence.IdPertence = id; _pertenceService.Atualizar(pertence); } return(RedirectToAction(nameof(Index))); }
public ActionResult Create(PertenceModel pertenceModel) { if (ModelState.IsValid) { var pertence = _mapper.Map <Pertence>(pertenceModel); pertence.StatusPertence = "Em Analise"; _pertenceService.Inserir(pertence); } return(RedirectToAction(nameof(Index))); }
// GET: Pertence/Edit/5 public ActionResult Edit(int id) { ViewBag.title_page = "Pertence"; ViewBag.path = "Início / Pertence / Editar"; IEnumerable <Tipopertence> listaTipoPertence = _tipopertenceService.ObterTodos(); ViewBag.idTipoPertence = new SelectList(listaTipoPertence, "IdTipoPertence", "Nome", null); Pertence pertence = _pertenceService.Obter(id); PertenceModel pertenceModel = _mapper.Map <PertenceModel>(pertence); return(View(pertenceModel)); }
public ActionResult Delete(int id, PertenceModel pertenceModel) { _pertenceService.Remover(id); return(RedirectToAction(nameof(Index))); }