コード例 #1
0
        public async Task <ActionResult <Country> > PutCountry(int id, Country country)
        {
            if (id != country.Id)
            {
                return(BadRequest());
            }

            if (await _service.GetEntity(id) == null)
            {
                await _service.InsertEntity(country);
            }
            else
            {
                await _service.UpdateEntity(country);
            }
            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> PutSubject(int id, Subject subject)
        {
            if (id != subject.Id)
            {
                return(BadRequest());
            }

            if (await _service.GetEntity(id) == null)
            {
                await _service.InsertEntity(subject);
            }
            else
            {
                await _service.UpdateEntity(subject);
            }

            return(NoContent());
        }
コード例 #3
0
        public async Task <IActionResult> PutAlloy(int id, Alloy alloy)
        {
            if (id != alloy.Id)
            {
                return(BadRequest());
            }

            if (await _service.GetEntity(id) == null)
            {
                await _service.InsertEntity(alloy);
            }
            else
            {
                await _service.UpdateEntity(alloy);
            }

            return(NoContent());
        }
コード例 #4
0
        public async Task <IActionResult> PutCurrency(int id, Currency currency)
        {
            if (id != currency.Id)
            {
                return(BadRequest());
            }

            if (await _service.GetEntity(id) == null)
            {
                await _service.InsertEntity(currency);
            }
            else
            {
                await _service.UpdateEntity(currency);
            }

            return(NoContent());
        }