Exemplo n.º 1
0
        public string Show(int id)
        {
            Institution Institution = new Institution();

            try
            {
                Institution.GetById(id);


                if (Institution != null)
                {
                    string jsonString = JsonSerializer.Serialize(Institution);
                    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);
            }
        }
Exemplo n.º 2
0
        public string Delete(int id)
        {
            Institution Institution = new Institution();

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

                    return(jsonString);
                }
                Institution.Id = id;
                Institution.Delete();

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

                return(jsonString);
            }
        }
Exemplo n.º 3
0
        public User(
            int id,
            string name,
            bool sex,
            string birthDate,
            string cpf,
            string rg,
            int institutionId,
            string role,
            string nivelDeAcesso,
            string email,
            string password,
            string description,
            string medicalCares,
            string avatarUrl,
            string addressReference,
            int addressNumber,
            int addressId)
        {
            this.id               = id;
            this.name             = name;
            this.sex              = sex;
            this.birthDate        = birthDate;
            this.cpf              = cpf;
            this.rg               = rg;
            this.institutionId    = institutionId;
            this.role             = role;
            this.nivelDeAcesso    = nivelDeAcesso;
            this.email            = email;
            this.password         = password;
            this.description      = description;
            this.medicalCares     = medicalCares;
            this.avatarUrl        = avatarUrl;
            this.addressReference = addressReference;
            this.addressNumber    = addressNumber;
            this.addressId        = addressId;

            address.GetById(addressId);
            institution.GetById(institutionId);
        }