public ResultHelper SetDeviceUser(DeviceUserDto deviceUserDto) { try { deviceuser item = new deviceuser(); item.DeviceUserID = deviceUserDto.DeviceUserID; item.DeviceID = deviceUserDto.DeviceID; item.UserID = deviceUserDto.UserID; using (UnitOfWork unitofWork = new UnitOfWork()) { unitofWork.GetRepository <deviceuser>().Update(item); unitofWork.saveChanges(); return(new ResultHelper(true, item.DeviceUserID, ResultHelper.SuccessMessage)); } } catch (Exception ex) { return(new ResultHelper(false, 0, ResultHelper.UnSuccessMessage)); } }
public DeviceUserDto GetDeviceUser(int deviceUserID) { try { using (UnitOfWork unitofWork = new UnitOfWork()) { deviceuser item = new deviceuser(); item = unitofWork.GetRepository <deviceuser>().GetById(x => x.DeviceUserID == deviceUserID); DeviceUserDto deviceUserDto = new DeviceUserDto(); deviceUserDto.DeviceID = item.DeviceID.Value; deviceUserDto.DeviceUserID = item.DeviceUserID; deviceUserDto.UserID = item.UserID.Value; return(deviceUserDto); } } catch (Exception ex) { return(null); } }