コード例 #1
0
        public ActionResult RemoveCompany(int id)
        {
            try
            {
                var company = _companyAppService.GetCompanyById(id);
                if (company == null)
                {
                    AdicionarErroProcessamento("Não foi possível localizar a empresa pelo id informado.");
                    return(CustomResponse());
                }

                _companyAppService.RemoveCompany(company);
                return(CustomResponse());
            }
            catch (Exception ex)
            {
                MessageException();
                return(CustomExceptionResponse());
            }
        }
コード例 #2
0
        public virtual IActionResult GetCompanyById([FromRoute] int id)
        {
            try
            {
                var companyCommand = _companyAppService.GetCompanyById(id);

                return(ReturnResponse(companyCommand, companyCommand, null));
            }
            catch (Exception e)
            {
                return(BadRequest("Error: " + e.Message));
            }
        }