public ActionResult Update(SemestreViewModel semestre) { MSemestre mSemestre = new MSemestre(); TempData["Message"] = mSemestre.Update(semestre) ? "Semestre atualizado com sucesso" : "Açao nao realizada"; return(RedirectToAction("Index")); }
public ActionResult Update(int id) { SemestreViewModel novo = new SemestreViewModel(); novo.idSemestre = id; return(View(novo)); }
public ActionResult Create(SemestreViewModel semestre) { MSemestre mSemestre = new MSemestre(); TempData["Message"] = mSemestre.Add(semestre) ? "Semestre cadastrado com sucesso" : "Ação não realizada"; return(RedirectToAction("Create")); }
public bool Update(SemestreViewModel t) { try { db.SpCrudSemestre(t.idSemestre, t.DataInicioModulo1, t.DataInicioModulo2, t.DataInicioModulo3, t.DataFinalModulo1, t.DataFinalModulo2, t.DataFinalModulo3, "Update"); } catch (Exception Ex) { Console.WriteLine(Ex.Message); return(false); } return(true); }
public ActionResult Update(int id) { SemestreViewModel novo = new SemestreViewModel(); Semestre semestre = new MSemestre().BringOne(c => c.idSemestre == id); novo.DataInicioModulo1 = semestre.Modulo.OrderBy(c => c.dtInicio).ElementAt(0).dtInicio.Value; novo.DataInicioModulo2 = semestre.Modulo.OrderBy(c => c.dtInicio).ElementAt(1).dtInicio.Value; novo.DataInicioModulo3 = semestre.Modulo.OrderBy(c => c.dtInicio).ElementAt(2).dtInicio.Value; novo.DataFinalModulo1 = semestre.Modulo.OrderBy(c => c.dtInicio).ElementAt(0).dtFim.Value; novo.DataFinalModulo2 = semestre.Modulo.OrderBy(c => c.dtInicio).ElementAt(1).dtFim.Value; novo.DataFinalModulo3 = semestre.Modulo.OrderBy(c => c.dtInicio).ElementAt(2).dtFim.Value; novo.idSemestre = id; novo.Descricao = semestre.descSemestre; return(View(novo)); }