示例#1
0
 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)));
 }
示例#2
0
        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)));
        }
示例#3
0
        // 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));
        }
示例#4
0
 public ActionResult Delete(int id, PertenceModel pertenceModel)
 {
     _pertenceService.Remover(id);
     return(RedirectToAction(nameof(Index)));
 }