public Entity.ActionStatus Delete(Guid id) { Entity.ActionStatus actionStatus = new Entity.ActionStatus(true); try { var dbDeviceType = _deviceTypeRepository.FindBy(x => x.Guid.Equals(id)).FirstOrDefault(); if (dbDeviceType == null) { throw new NotFoundCustomException($"{CommonException.Name.NoRecordsFound} : DeviceType"); } var dbDevice = _deviceRepository.FindBy(x => x.TypeGuid.Equals(id) && !x.IsDeleted).FirstOrDefault(); if (dbDevice == null) { dbDeviceType.IsDeleted = true; dbDeviceType.UpdatedDate = DateTime.Now; dbDeviceType.UpdatedBy = SolutionConfiguration.CurrentUserId; return(_deviceTypeRepository.Update(dbDeviceType)); } else { _logger.Error($"Device Type is not updated in solution database.Device exists, Error: {actionStatus.Message}"); actionStatus.Success = false; actionStatus.Message = "Asset Type status cannot be deleted because device exists"; } } catch (Exception ex) { _logger.Error(Constants.ACTION_EXCEPTION, "DeviceType.Delete " + ex); actionStatus.Success = false; actionStatus.Message = ex.Message; } return(actionStatus); }
public bool UpdateDeviceType(DeviceType deviceType) { bool isSuccess = true; try { deviceTypeRepository.Update(deviceType); this.SaveRecord(); ServiceUtil <DeviceType> .WriteActionLog(deviceType.Id, ENUMOperation.UPDATE, deviceType); } catch (Exception ex) { isSuccess = false; logger.Error("Error in updating DeviceType", ex); } return(isSuccess); }
public void UpdateDeviceType(DeviceType devicetype) { devicetypeRepository.Update(devicetype); }
public void UpdateDeviceType(DeviceType newDeviceType, int selectedDeviceTypeId) { _repository.Update(newDeviceType, selectedDeviceTypeId); }