public bool UpdateDeviceSetup(DeviceSetup deviceSetup) { bool isSuccess = true; try { deviceSetupRepository.Update(deviceSetup); this.SaveRecord(); ServiceUtil <DeviceSetup> .WriteActionLog(deviceSetup.Id, ENUMOperation.UPDATE, deviceSetup); } catch (Exception ex) { isSuccess = false; logger.Error("Error in updating DeviceSetup", ex); } return(isSuccess); }
public IActionResult UpdateDeviceSetup(int id, [FromBody] FoodItemDto dto) { DeviceSetup deviceSetupToCheck = _deviceSetupRepository.GetSingle(id); if (deviceSetupToCheck == null) { return(NotFound()); } if (id != dto.Id) { return(BadRequest("ids do not match")); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var updatedItem = _deviceSetupRepository.Update(AutoMapper.Mapper.Map <DeviceSetup>(dto)); return(Ok(AutoMapper.Mapper.Map <DeviceSetupDto>(updatedItem))); }