public IActionResult AtualizarTipoPresenca(int id, TipoRegimePresencial trp) { try { return(Ok(_Admin.AtualizarTipoPresenca(id, trp))); } catch (Exception) { return(BadRequest()); } }
public IActionResult AdicionarTipoPresenca(TipoRegimePresencial trp) { try { return(Ok(_Admin.AdicionarTipoPresenca(trp))); } catch (Exception) { return(BadRequest()); } }
public bool AdicionarTipoPresenca(TipoRegimePresencial trp) { using (DbSenaiContext ctx = new DbSenaiContext()) { try { if (trp.NomeTipoRegimePresencial != null) { ctx.Add(trp); ctx.SaveChanges(); return(true); } return(false); } catch (Exception) { return(false); } } }
public bool AtualizarTipoPresenca(int id, TipoRegimePresencial trp) { using (DbSenaiContext ctx = new DbSenaiContext()) { try { TipoRegimePresencial tipo = ctx.TipoRegimePresencial.Find(id); if (trp.NomeTipoRegimePresencial != null && tipo != null) { ctx.Update(trp); ctx.SaveChanges(); return(true); } return(false); } catch (Exception) { return(false); } } }