public ActionResult UpdateCompany(CompanyRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(CustomResponse(ModelState));
            }

            try
            {
                var company = _mapper.Map <CompanyRequest, Company>(request);
                if (company.Notifications.Any())
                {
                    return(CustomResponse(company.Notifications));
                }

                _companyAppService.UpdateCompany(company);
                var companyResponse = _mapper.Map <Company, CompanyResponse>(company);
                return(CustomResponse(companyResponse));
            }
            catch (Exception ex)
            {
                MessageException();
                return(CustomExceptionResponse());
            }
        }
Exemple #2
0
        public async Task <CompanyDto> Update(CompanyDto company)
        {
            var companyDto = await _companyService.UpdateCompany(company);

            if (companyDto == null)
            {
                return(null);
            }

            return(companyDto);
        }
        public virtual IActionResult UpdateCompany([FromBody] CompanyViewModel company)
        {
            try
            {
                var companyCommand = _companyAppService.UpdateCompany(company);

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