示例#1
0
        public async Task <IActionResult> Edit(int id, Computer computer)
        {
            if (id != computer.Id)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var toUpdate = await _computerRepository.GetByIdAsync(id);

            if (toUpdate == null)
            {
                return(NotFound());
            }

            await _computerRepository.UpdateAsync(computer.ToEntityModel());

            return(Ok());
        }