public DefaultResults Put(int id, [FromBody] PersonViewModel model)
        {
            var result          = new DefaultResults();
            var validatedResult = _validated.Validate(model);

            if (validatedResult.IsValid)
            {
                try
                {
                    result.Success = _personAplicationService.Update(model);
                    if (!result.Success)
                    {
                        throw new Exception($"Person{id} can't be updated");
                    }
                }
                catch (Exception ex)
                {
                    result.Erros = new string[] { ex.Message };
                }
            }
            else
            {
                result.Erros = validatedResult.GetErros();
            }
            return(result);
        }
        public DefaultResults <IEnumerable <PersonViewModel> > Get([FromQuery] PersonFilterViewModel filter)
        {
            var result = new DefaultResults <IEnumerable <PersonViewModel> >();

            try
            {
                result.Result  = _personAplicationService.GetLatestCalc(filter);
                result.Success = true;
            }
            catch (Exception ex)
            {
                result.Erros = new string[] { ex.Message };
            }
            return(result);
        }
        public DefaultResults <PersonViewModel> Get(Guid id)
        {
            var result = new DefaultResults <PersonViewModel>();


            try
            {
                result.Result  = _personAplicationService.GetById(id);
                result.Success = true;
            }
            catch (Exception ex)
            {
                result.Erros = new string[] { ex.Message };
            }

            return(result);
        }
        public DefaultResults Delete(Guid id)
        {
            var result = new DefaultResults();

            try
            {
                result.Success = _personAplicationService.Delete(id);
                if (!result.Success)
                {
                    throw new Exception($"Person{id} can't be deleted");
                }
                return(result);
            }
            catch (Exception ex)
            {
                result.Erros = new string[] { ex.Message };
            }
            return(result);
        }
        public DefaultResults <PersonViewModel> Post([FromBody] PersonViewModel model)
        {
            var result = new DefaultResults <PersonViewModel>();

            var validatedResult = _validated.Validate(model);

            if (validatedResult.IsValid)
            {
                try
                {
                    result.Result  = _personAplicationService.CreatePerson(model);
                    result.Success = true;
                }
                catch (Exception ex)
                {
                    result.Erros = new string[] { ex.Message };
                }
            }
            else
            {
                result.Erros = validatedResult.GetErros();
            }
            return(result);
        }