コード例 #1
0
        public IActionResult Put(int id, [FromBody] Company updateCompany)
        {
            updateCompany.Id = id;
            var retval = repo.Update(updateCompany);

            return(StatusCode(StatusCodes.Status200OK, retval));
        }
コード例 #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());
        }
コード例 #3
0
        public Company Update(Company company)
        {
            var Company = _companyRepo.Update(company);

            return(Company);
        }