Beispiel #1
0
        public string Delete(int id)
        {
            Institution_has_User institution_has_User = new Institution_has_User();

            try
            {
                Institution_has_User.GetById(id);
                if (Institution_has_User == null)
                {
                    Error  error      = new Error("Nao encontrado");
                    string jsonString = JsonSerializer.Serialize(error);

                    return(jsonString);
                }
                Institution_has_User.Delete(id);

                return("Deletado com Sucesso");
            }
            catch (Exception ex)
            {
                Error  error      = new Error(ex.ToString());
                string jsonString = JsonSerializer.Serialize(error);

                return(jsonString);
            }
        }
Beispiel #2
0
        public string Show(int id)
        {
            Institution_has_User institution_has_User = new Institution_has_User();

            try
            {
                Institution_has_User.GetById(id);


                if (Institution_has_User != null)
                {
                    string jsonString = JsonSerializer.Serialize(Institution_has_User);
                    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);
            }
        }