// // GET: /planoDeConta/Edit/5 public ActionResult Edit(int id) { PlanoDeContaModel planoDeConta = gPlanoDeConta.Obter(id); ViewBag.IdGrupoPlanoDeConta = new SelectList(gGrupoPlanoDeContas.ObterTodos(), "IdGrupoPlanoDeConta", "Descricao", planoDeConta.IdGrupoPlanoDeConta); return(View(planoDeConta)); }
/// <summary> /// Altera dados na base de dados /// </summary> /// <param name="planoDeContaModel">Dados do modelo</param> public void Editar(PlanoDeContaModel planoDeContaModel) { tb_planodeconta planoDeContaE = new tb_planodeconta(); Atribuir(planoDeContaModel, planoDeContaE); unitOfWork.RepositorioPlanoDeConta.Editar(planoDeContaE); unitOfWork.Commit(shared); }
/// <summary> /// Insere um novo na base de dados /// </summary> /// <param name="planoDeContaModel">Dados do modelo</param> /// <returns>Chave identificante na base</returns> public int Inserir(PlanoDeContaModel planoDeContaModel) { tb_planodeconta planoDeContaE = new tb_planodeconta(); Atribuir(planoDeContaModel, planoDeContaE); unitOfWork.RepositorioPlanoDeConta.Inserir(planoDeContaE); unitOfWork.Commit(shared); return(planoDeContaE.IdPlanoDeConta); }
public ActionResult Edit(PlanoDeContaModel planoDeConta) { if (ModelState.IsValid) { gPlanoDeConta.Editar(planoDeConta); return(RedirectToAction("Index")); } ViewBag.IdGrupoPlanoDeConta = new SelectList(gGrupoPlanoDeContas.ObterTodos(), "IdGrupoPlanoDeConta", "Descricao", planoDeConta.IdGrupoPlanoDeConta); return(View(planoDeConta)); }
/// <summary> /// Atribui dados do PlanoDeConta Model para o PlanoDeConta Entity /// </summary> /// <param name="planoDeContaModel">Objeto do modelo</param> /// <param name="planoDeContaE">Entity mapeada da base de dados</param> private void Atribuir(PlanoDeContaModel planoDeContaModel, tb_planodeconta planoDeContaE) { planoDeContaE.IdPlanoDeConta = planoDeContaModel.IdPlanoDeConta; planoDeContaE.Descricao = planoDeContaModel.Descricao; planoDeContaE.IdTipoPlanoDeConta = planoDeContaModel.IdGrupoPlanoDeConta; }
// // GET: /planoDeConta/Delete/5 public ActionResult Delete(int id) { PlanoDeContaModel planoDeConta = gPlanoDeConta.Obter(id); return(View(planoDeConta)); }
// // GET: /planoDeConta/Details/5 public ViewResult Details(int id) { PlanoDeContaModel planoDeConta = gPlanoDeConta.Obter(id); return(View(planoDeConta)); }