Exemple #1
0
        public ExameModel Alterar(int id, [FromBody] ExameModel exameModel)
        {
            var exame = exameModel.ToEntity();

            exame.Id = id;
            exameServico.Salvar(exame);

            return(new ExameModel().FromEntity(exame));
        }
Exemple #2
0
        public ExameModel Cadastrar(ExameModel exameModel)
        {
            exameModel.Validar();

            var exame = exameModel.ToEntity();

            exameServico.Salvar(exame);

            exame = exameServico.BuscarPorId(exame.Id);

            var body = $"Olá, foi adicionado o exame \"{exame.Nome}\". <br />";

            body += $"Nome do exame: {exame.Nome}<br />";

            return(new ExameModel().FromEntity(exame));
        }