예제 #1
0
        public IHttpActionResult PostHardware(HardwareDto hardwareDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var hardware = MapBackToModel(hardwareDto);

            hardware    = _repository.Create(hardware);
            hardwareDto = MapBackToDto(hardware);

            return(CreatedAtRoute("DefaultApi", new { id = hardware.Id }, hardwareDto));
        }