// GET: /Projeto/ public ActionResult FindXmlWithSelectedProject(int id) { ProjetoModel objProjeto = new ProjetoModel(); TB_PROJETO objPrj = null; TB_PLANILHA_Repository planilhaRepository = new TB_PLANILHA_Repository(); TB_PROJETO_Repository projetoRepository = new TB_PROJETO_Repository(); objPrj = projetoRepository.getProjeto(idProjeto: id); if (objPrj != null) { objProjeto = new ProjetoModel { idProjeto = objPrj.idPROJETO, xPROJETO = objPrj.xPROJETO, dtCADASTRO = objPrj.dtCADASTRO }; objProjeto.ldadosPlanilhaOriginal = planilhaRepository.getPlanilhasByIdProjeto(idProjeto: id); } base.SessionProjetoModel = objProjeto; //ProjetoBO.OrganizeDadosParaParametroInicial(base.SessionProjetoModel); return(RedirectToAction(actionName: "Parametros", controllerName: "Projeto")); }
public TB_PROJETO getProjeto(int idProjeto) { TB_PROJETO prj = null; try { using (var con = new DB_YAZAKIEntities()) { prj = con.TB_PROJETO.FirstOrDefault(i => i.idPROJETO == idProjeto); } } catch (Exception ex) { throw ex; } return(prj); }
public bool Delete(int id) { try { using (var con = new DB_YAZAKIEntities()) { TB_PROJETO p = con.TB_PROJETO.FirstOrDefault(i => i.idPROJETO == id); con.TB_PROJETO.Remove(entity: p); con.SaveChanges(); } return(true); } catch (Exception ex) { throw ex; } }
public int Save(TB_PROJETO objProjeto) { if (objProjeto.idPROJETO == 0) { using (var con = new DB_YAZAKIEntities()) { con.TB_PROJETO.Add(entity: objProjeto); con.SaveChanges(); } } else { using (var con = new DB_YAZAKIEntities()) { con.TB_PROJETO.Attach(entity: objProjeto); con.Entry(entity: objProjeto).State = System.Data.Entity.EntityState.Modified; con.SaveChanges(); } } return(objProjeto.idPROJETO); }