public string Delete(int id) { SubEvent subEvent = new SubEvent(); try { SubEvent.GetById(id); if (SubEvent == null) { Error error = new Error("Nao encontrado"); string jsonString = JsonSerializer.Serialize(error); return(jsonString); } SubEvent.Delete(id); return("Deletado com Sucesso"); } catch (Exception ex) { Error error = new Error(ex.ToString()); string jsonString = JsonSerializer.Serialize(error); return(jsonString); } }
public string Show(int id) { SubEvent subEvent = new SubEvent(); try { SubEvent.GetById(id); if (SubEvent != null) { string jsonString = JsonSerializer.Serialize(SubEvent); return(jsonString); } else { Error error = new Error("Nao encontrado"); string jsonString = JsonSerializer.Serialize(error); return(jsonString); } } catch (Exception ex) { Error error = new Error(ex.ToString()); string jsonString = JsonSerializer.Serialize(error); return(jsonString); } }