private void onUpdate() { mdc = new Model.Model(); try { Materias_Edit materia = mdc.Materia.First(mat => mat.idMateria == int.Parse(tbCodMateria.Text.Trim())); tbNome.Text = materia.tbNome.Text.Trim(); tbDescricao.Text = materia.tbDescricao.Text.Trim(); materia.dataAtualizacao = DateTime.Parse(DateTime.Now.ToShortDateString()); mdc.AcceptChanges(); Response.Redirect("Materias.aspx"); } catch (Exception) { } finally { mdc.Dispose(); } }
private void onDelete() { mdc = new Model.Model(); try { Materias_Edit materia = mdc.Materia.First(mat => mat.idMateria == int.Parse(tbCodigo.Text.Trim())); mdc.Materia.RowDeleted(); mdc.AcceptChanges(); Response.Redirect("Materias.aspx"); } catch (Exception) { } finally { mdc.Dispose(); } }