示例#1
0
        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);
            }
        }
示例#2
0
        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);
            }
        }