public IActionResult Put(int id, [FromBody] Company updateCompany)
        {
            updateCompany.Id = id;
            var retval = repo.Update(updateCompany);

            return(StatusCode(StatusCodes.Status200OK, retval));
        }
Esempio n. 2
0
        public async Task <IActionResult> Update([Required] long id, CompanyDto companyItem)
        {
            if (id != companyItem.Id)
            {
                return(BadRequest("Wrong company id"));
            }

            var company = await _companyRepo.FindCompanyByNameAsync(companyItem.Name);

            if (company != null)
            {
                _logger.LogWarning($"Company with name '{companyItem.Name}' exist with Id={company.Id}");
                return(BadRequest($"Company with name '{companyItem.Name}' exist with Id={company.Id}"));
            }

            await _companyRepo.Update(companyItem);

            return(NoContent());
        }
Esempio n. 3
0
        public Company Update(Company company)
        {
            var Company = _companyRepo.Update(company);

            return(Company);
        }